-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dbf901
commit 3a4ac6f
Showing
1 changed file
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
name: Close All Issues | ||
|
||
on: | ||
workflow_dispatch: # Allows you to manually trigger the workflow | ||
workflow_dispatch: # Allows the workflow to be triggered manually | ||
|
||
jobs: | ||
close_issues: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Close all issues | ||
- name: Close all open issues | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const issues = await github.paginate(github.rest.issues.listForRepo, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open' | ||
state: 'open' // Fetch only open issues | ||
}); | ||
|
||
for (const issue of issues) { | ||
if (!issue.pull_request) { // Ensure it's an issue, not a PR | ||
if (!issue.pull_request) { // Ensure it’s an issue, not a pull request | ||
await github.rest.issues.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue.number, | ||
state: 'closed' | ||
}); | ||
console.log(`Closed issue #${issue.number}: ${issue.title}`); | ||
} | ||
} |