From 6ad27a34df34512776dea9353cbc656a58b711e4 Mon Sep 17 00:00:00 2001 From: Deep-Dark-Forest Date: Sun, 2 Feb 2025 22:26:23 +0800 Subject: [PATCH] update --- .github/workflows/issue-close.yml | 36 +++++++++++-------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/.github/workflows/issue-close.yml b/.github/workflows/issue-close.yml index 03207b42..0f0c6a8c 100644 --- a/.github/workflows/issue-close.yml +++ b/.github/workflows/issue-close.yml @@ -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 @@ -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\"}"