Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

permissions:
contents: write
issues: write

jobs:
minimal-setup:
Expand All @@ -20,14 +21,42 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Enable branch auto-deletion via API
- name: Enable branch auto-deletion
run: |
curl -s -X PATCH "https://api.github.com/repos/${{ github.repository }}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-d '{"delete_branch_on_merge":true}'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-d '{"delete_branch_on_merge":true}'

- name: Create / update default issue labels
shell: bash
run: |
declare -A labels=(
["breaking"]="d20f48:Breaking changes or backwards-incompatible updates"
["feature"]="2ecc71:New functionality or enhancements"
["maintenance"]="f39c12:Codebase cleanup or non-feature updates"
["performance"]="f1c40f:Performance-related improvements"
["tests"]="1abc9c:Adding or updating tests"
)

for name in "${!labels[@]}"; do
IFS=':' read -r color desc <<< "${labels[$name]}"

# Erstellt das Label, fällt bei 422 (already exists) zurück auf PATCH
status=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-d "{\"name\":\"${name}\",\"color\":\"${color}\",\"description\":\"${desc}\"}" \
"https://api.github.com/repos/${{ github.repository }}/labels")

if [ "$status" = "422" ]; then
curl -s -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-d "{\"new_name\":\"${name}\",\"color\":\"${color}\",\"description\":\"${desc}\"}" \
"https://api.github.com/repos/${{ github.repository }}/labels/${name}"
fi
done

- name: Delete this workflow file
run: |
Expand Down
Loading