From e9a7b3349b019782a8bcd2ab29a829054b28329d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 10 Aug 2022 17:10:48 +0100 Subject: [PATCH] Update issue_closed.yml (#23048) --- .github/workflows/issue_closed.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/issue_closed.yml b/.github/workflows/issue_closed.yml index 9bc4e76a4a..935740f299 100644 --- a/.github/workflows/issue_closed.yml +++ b/.github/workflows/issue_closed.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/github-script@v5 + id: main with: # PAT needed as the GITHUB_TOKEN won't be able to see cross-references from other orgs (matrix-org) github-token: ${{ secrets.ELEMENT_BOT_TOKEN }} @@ -127,13 +128,7 @@ jobs: // Duplicate was closed with wrong reason, fix it if (stateReason === "COMPLETED") { - await github.graphql(`mutation($id:ID!) { - closeIssue(input: { issueId:$id, stateReason:NOT_PLANNED }) { - clientMutationId - } - }`, { - id: context.payload.issue.node_id, - }); + core.setOutput("closeAsNotPlanned", "true"); } } else { // This issue was closed, close all related rageshakes @@ -146,3 +141,16 @@ jobs: }); } } + - uses: actions/github-script@v5 + name: Close duplicate as Not Planned + if: steps.main.outputs.closeAsNotPlanned + with: + # We do this step separately, and with the default token so as to not re-trigger this workflow when re-closing + script: | + await github.graphql(`mutation($id:ID!) { + closeIssue(input: { issueId:$id, stateReason:NOT_PLANNED }) { + clientMutationId + } + }`, { + id: context.payload.issue.node_id, + });