Skip to content

Commit e9a7b33

Browse files
authored
Update issue_closed.yml (#23048)
1 parent 2cd0bb7 commit e9a7b33

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/issue_closed.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/github-script@v5
13+
id: main
1314
with:
1415
# PAT needed as the GITHUB_TOKEN won't be able to see cross-references from other orgs (matrix-org)
1516
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
@@ -127,13 +128,7 @@ jobs:
127128
128129
// Duplicate was closed with wrong reason, fix it
129130
if (stateReason === "COMPLETED") {
130-
await github.graphql(`mutation($id:ID!) {
131-
closeIssue(input: { issueId:$id, stateReason:NOT_PLANNED }) {
132-
clientMutationId
133-
}
134-
}`, {
135-
id: context.payload.issue.node_id,
136-
});
131+
core.setOutput("closeAsNotPlanned", "true");
137132
}
138133
} else {
139134
// This issue was closed, close all related rageshakes
@@ -146,3 +141,16 @@ jobs:
146141
});
147142
}
148143
}
144+
- uses: actions/github-script@v5
145+
name: Close duplicate as Not Planned
146+
if: steps.main.outputs.closeAsNotPlanned
147+
with:
148+
# We do this step separately, and with the default token so as to not re-trigger this workflow when re-closing
149+
script: |
150+
await github.graphql(`mutation($id:ID!) {
151+
closeIssue(input: { issueId:$id, stateReason:NOT_PLANNED }) {
152+
clientMutationId
153+
}
154+
}`, {
155+
id: context.payload.issue.node_id,
156+
});

0 commit comments

Comments
 (0)