From 9ed576ed0379c648cd6ca3f6bb394235dda0353e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E9=BB=91=E6=A3=AE=E6=9E=97?= Date: Sun, 26 Jan 2025 10:58:34 +0800 Subject: [PATCH] Update issues.yml --- .github/workflows/issues.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index b85db292..4b4d5f98 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -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