-
Notifications
You must be signed in to change notification settings - Fork 55
Delete stale ci it already exists #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0c77274
Update to use stale github issue action
YunchuWang a82b354
make it longer
YunchuWang 238a461
only scan need autho feedback issues
YunchuWang 57ba187
action permission
YunchuWang b1284d3
comments
YunchuWang cc13bcb
delete stale ci
YunchuWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,63 +1,26 @@ | ||
| name: Close inactive author feedback issues | ||
|
|
||
| name: Close inactive issues | ||
| on: | ||
|
YunchuWang marked this conversation as resolved.
Outdated
|
||
| schedule: | ||
| - cron: "0 9 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| - cron: "0 1 * * *" # run daily | ||
|
|
||
| jobs: | ||
| close-inactive: | ||
| stale: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
|
|
||
|
YunchuWang marked this conversation as resolved.
Outdated
|
||
| steps: | ||
| - name: Close issues waiting on author feedback | ||
| uses: actions/github-script@v7 | ||
| - uses: actions/stale@v10 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const label = "Needs Author Feedback"; | ||
| const daysInactive = 7; | ||
| const cutoff = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1000); | ||
|
|
||
| const { owner, repo } = context.repo; | ||
| const issues = await github.paginate(github.rest.issues.listForRepo, { | ||
| owner, | ||
| repo, | ||
| state: "open", | ||
| labels: label, | ||
| per_page: 100, | ||
| sort: "updated", | ||
| direction: "asc", | ||
| }); | ||
|
|
||
| for (const issue of issues) { | ||
| if (issue.pull_request) { | ||
| continue; | ||
| } | ||
|
|
||
| const updatedAt = new Date(issue.updated_at); | ||
| if (updatedAt > cutoff) { | ||
| continue; | ||
| } | ||
|
|
||
| const body = [ | ||
| "We haven't heard back in 7 days, so we're automatically closing this issue.", | ||
| "If you still need help, please reply and we can reopen it." | ||
| ].join("\n\n"); | ||
|
|
||
| try { | ||
| await github.rest.issues.createComment({ owner, repo, issue_number: issue.number, body }); | ||
| } catch (error) { | ||
| console.warn(`Skipping issue #${issue.number} because of an error while adding the notice: ${error}`); | ||
| continue; | ||
| } | ||
|
|
||
| try { | ||
| await github.rest.issues.update({ owner, repo, issue_number: issue.number, state: "closed" }); | ||
| } catch (error) { | ||
| console.warn(`Skipping issue #${issue.number} because of an error while processing closure: ${error}`); | ||
| } | ||
| } | ||
| # issues that haven’t updated in 30 days become stale | ||
| days-before-issue-stale: 30 | ||
| # issues labeled stale will be closed 14 days later | ||
| days-before-issue-close: 14 | ||
| stale-issue-label: "stale" | ||
| stale-issue-message: "This issue has gone quiet — please respond!" | ||
|
YunchuWang marked this conversation as resolved.
Outdated
|
||
| close-issue-message: "Closing this issue as inactive." | ||
|
YunchuWang marked this conversation as resolved.
Outdated
YunchuWang marked this conversation as resolved.
Outdated
|
||
| # don’t process PRs | ||
| days-before-pr-stale: -1 | ||
| days-before-pr-close: -1 | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.