Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Deep-Dark-Forest committed Feb 2, 2025
1 parent 17aba53 commit 6ad27a3
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/issue-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ on:
jobs:
handle-label:
runs-on: ubuntu-latest
strategy:
matrix:
label-reason-pair:
- { label: "❌ 拒绝", reason: "not_planned" }
- { label: "😂 移交上游", reason: "not_planned" }
- { label: "❌ 忽略", reason: "not_planned" }
- { label: "❌ 第三方", reason: "not_planned" }
- { label: "❌ 暂无计划", reason: "not_planned" }
- { label: "👌 完成", reason: "completed" }
- { label: "❌ 重复", reason: "duplicate" }

steps:
- name: Set up environment variables
Expand All @@ -23,36 +33,14 @@ jobs:
echo "LABEL_NAME=$LABEL_NAME" >> $GITHUB_ENV
echo "GITHUB_TOKEN=$GITHUB_TOKEN" >> $GITHUB_ENV
- name: Determine action based on label
id: set_action
run: |
case "$LABEL_NAME" in
"❌ 拒绝"|"😂 移交上游"|"❌ 忽略"|"❌ 第三方"|"❌ 暂无计划")
echo "::set-output name=state::closed"
echo "::set-output name=reason::not_planned"
;;
"👌 完成")
echo "::set-output name=state::closed"
echo "::set-output name=reason::completed"
;;
"❌ 重复")
echo "::set-output name=state::closed"
echo "::set-output name=reason::duplicate"
;;
*)
echo "::set-output name=state::open"
echo "::set-output name=reason::none"
;;
esac
- name: Close issue if needed
if: steps.set_action.outputs.state == 'closed'
if: env.LABEL_NAME == matrix.label-reason-pair.label
run: |
curl -X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$ISSUE_NUMBER \
-d "{\"state\": \"${{ steps.set_action.outputs.state }}\"}"
-d "{\"state\": \"closed\"}"

0 comments on commit 6ad27a3

Please sign in to comment.