diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 2542dfcf..10d46e77 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -41,7 +41,8 @@ jobs: 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 '. + ["❌ 重复"]' | sed 's/[][]//g' | sed 's/"//g') - new_labels="[$new_labels]" + new_labels=$(echo $new_labels | sed 's/,/, /g') + new_labels='["'$(echo $new_labels | sed 's/ /","/g')'"]' curl -X PATCH \ -H "Authorization: token ${{ secrets.SHEEP }}" \ -H "Accept: application/vnd.github.v3+json" \ @@ -49,7 +50,8 @@ jobs: -d '{"labels": '$new_labels'}' elif [[ "${{ github.event.issue.state_reason }}" == "completed" ]]; then new_labels=$(echo $existing_labels | jq -c '. + ["👌 完成"]' | sed 's/[][]//g' | sed 's/"//g') - new_labels="[$new_labels]" + new_labels=$(echo $new_labels | sed 's/,/, /g') + new_labels='["'$(echo $new_labels | sed 's/ /","/g')'"]' curl -X PATCH \ -H "Authorization: token ${{ secrets.SHEEP }}" \ -H "Accept: application/vnd.github.v3+json" \