Skip to content

Commit

Permalink
Update close all issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjaliavv51 authored Dec 20, 2024
1 parent 0dbf901 commit 3a4ac6f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/close all issues
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 its 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}`);
}
}

0 comments on commit 3a4ac6f

Please sign in to comment.