Skip to content

Commit

Permalink
Update issues.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Deep-Dark-Forest authored Jan 26, 2025
1 parent 48fe553 commit 9ed576e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ jobs:
- name: Handle closed issues
if: github.event.action == 'closed'
run: |
existing_labels=$(curl -s -H "Authorization: token ${{ secrets.SHEEP }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} | jq -r '.labels | map(.name) | join(",")')
if [[ "${{ github.event.issue.state_reason }}" == "duplicate" ]]; then
new_labels="$existing_labels,❌ 重复"
curl -X PATCH \
-H "Authorization: token ${{ secrets.SHEEP }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"labels": ["❌ 重复"]}'
-d '{"labels": ["'$new_labels'"]}'
elif [[ "${{ github.event.issue.state_reason }}" == "completed" ]]; then
new_labels="$existing_labels,👌 完成"
curl -X PATCH \
-H "Authorization: token ${{ secrets.SHEEP }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"labels": ["👌 完成"]}'
-d '{"labels": ["'$new_labels'"]}'
fi

0 comments on commit 9ed576e

Please sign in to comment.