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 28, 2025
1 parent 944a4f4 commit b2eb2df
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,3 @@ jobs:
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"state": "closed", "state_reason": "completed"}'
fi
- 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)')
if [[ "${{ github.event.issue.state_reason }}" == "duplicate" ]]; then
new_labels=$(echo $existing_labels | jq -c '. + ["❌ 重复"]' | jq -c '. | map(gsub("\\s+"; ""))')
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": '$new_labels'}'
elif [[ "${{ github.event.issue.state_reason }}" == "completed" ]]; then
new_labels=$(echo $existing_labels | jq -c '. + ["👌 完成"]' | jq -c '. | map(gsub("\\s+"; ""))')
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": '$new_labels'}'
fi

0 comments on commit b2eb2df

Please sign in to comment.