-
Notifications
You must be signed in to change notification settings - Fork 18
Add workflow to label stale issues and PRs #101
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6fbd5bf
Add workflow to label stale issues and PRs
mhucka 4a115a7
Fix incorrect copyright attribution
mhucka 8d72ed3
Rename .yml → .yaml
mhucka ee754de
Merge branch 'main' into mh-add-stale-issue-handler
mhucka 58af19c
Merge branch 'main' into mh-add-stale-issue-handler
LalehB b0689ac
Merge branch 'main' into mh-add-stale-issue-handler
mhucka 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 |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| # Copyright 2025 The Cirq Developers | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| # Perform scheduled handling of stale issues and PRs. | ||
| # For info about possible config options, see https://github.com/actions/stale/. | ||
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| name: "Stale issues & PRs handler" | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 0 * * *' | ||
|
|
||
| # Allow manual invocation. | ||
| workflow_dispatch: | ||
| inputs: | ||
| debug: | ||
| # Note: the job body sets `debug-only` to false by default. The value | ||
| # of inputs.debug is an empty string unless this workflow is invoked | ||
| # manually. When it's invoked manually, GitHub's GUI presents the user | ||
| # with a checkbox for this flag. We default that checkbox to true | ||
| # because the most likely reason for a manual run is debugging. | ||
| description: 'Run in debug mode (dry run)' | ||
| type: boolean | ||
| default: true | ||
|
|
||
| env: | ||
| # Set durations here, to avoid hardcoding them in multiplate places below. | ||
| days-before-stale: 90 | ||
| days-before-close: 60 | ||
|
|
||
| # The syntax for the "actions/stale" GHA uses a comma-separated list, a format | ||
| # that's hard to read and inconvenient to edit (especially w/ many labels that | ||
| # use characters such as slash or colon). So instead, we put individual labels | ||
| # on separate lines here. A job step below converts this to the right form. | ||
| exempt-issue-labels-list: | ||
| help wanted | ||
| exempt-pr-labels-list: | ||
| health | ||
|
|
||
| # Declare default workflow permissions as read only. | ||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| stale: | ||
| if: github.repository_owner == 'quantumlib' | ||
| name: Label and/or close stale issues and PRs | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| env: | ||
| # Setting Bash SHELLOPTS here takes effect for all shell commands below. | ||
| SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }} | ||
| steps: | ||
| - name: Convert data types | ||
| id: converted | ||
| run: | | ||
| issues=$(echo "${{env.exempt-issue-labels-list}}" | tr ' ' ',') | ||
| prs=$(echo "${{env.exempt-pr-labels-list}}" | tr ' ' ',') | ||
| echo "exempt-issue-labels='$issues'" >> "$GITHUB_OUTPUT" | ||
| echo "exempt-pr-labels='$prs'" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Label and/or close stale issues and/or PRs | ||
| uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9 | ||
| with: | ||
| repo-token: ${{secrets.GITHUB_TOKEN}} | ||
| debug-only: ${{inputs.debug || false}} | ||
| days-before-stale: ${{env.days-before-stale}} | ||
| days-before-close: ${{env.days-before-close}} | ||
| stale-issue-label: 'stale' | ||
| stale-pr-label: 'stale' | ||
| close-issue-label: 'stale' | ||
| close-pr-label: 'stale' | ||
| exempt-issue-labels: ${{steps.converted.outputs.exempt-issue-labels}} | ||
| exempt-pr-labels: ${{steps.converted.outputs.exempt-pr-labels}} | ||
| stale-issue-message: >- | ||
| This issue has been automatically labeled as stale because | ||
| ${{env.days-before-stale}} days have passed without comments or other | ||
| activity. If no further activity occurs on this issue and the | ||
| `status/stale` label is not removed by a maintainer within | ||
| ${{env.days-before-close}} days, this issue will be closed. If you | ||
| would like to restore its status, please leave a comment here; doing | ||
| so will cause the staleness handler to remove the label. | ||
|
|
||
|
|
||
| If you have questions or feedback about this process, we welcome your | ||
| input. You can open a new issue to let us know (please also reference | ||
| this issue there, for continuity), or reach out to the project | ||
| maintainers at [email protected]. | ||
|
|
||
| stale-pr-message: >- | ||
| This pull request has been automatically labeled as stale because | ||
| ${{env.days-before-stale}} days have passed without comments or other | ||
| activity. If no further activity occurs and the `status/stale` label | ||
| is not removed by a maintainer within ${{env.days-before-close}} | ||
| days, this pull request will be closed. If you would like to restore | ||
| its active status, please leave a comment here; doing so will cause | ||
| the staleness handler to remove the label. | ||
|
|
||
|
|
||
| If you have questions or feedback about this process, we welcome your | ||
| input. You can open a new issue to let us know (please also reference | ||
| this issue there, for continuity), or reach out to the project | ||
| maintainers at [email protected]. | ||
|
|
||
| close-issue-message: >- | ||
| This issue has been closed due to inactivity for | ||
| ${{env.days-before-close}} days since the time the `status/stale` | ||
| label was applied. If you believe the issue is still relevant and | ||
| would like to restore its active status, please feel free to reopen | ||
| it. | ||
|
|
||
|
|
||
| If you have questions or feedback about this process, we welcome your | ||
| input. You can open a new issue to let us know (please also reference | ||
| this issue there, for continuity), or reach out to the project | ||
| maintainers at [email protected]. | ||
|
|
||
| close-pr-message: >- | ||
| This pull request has been closed due to inactivity for | ||
| ${{env.days-before-close}} days since the time the `status/stale` | ||
| label was applied. If you would like to continue working on this PR, | ||
| please feel free to reopen it. | ||
|
|
||
|
|
||
| If you have questions or feedback about this process, we welcome your | ||
| input. You can open a new issue to let us know (please also reference | ||
| this issue there, for continuity), or reach out to the project | ||
| maintainers at [email protected]. | ||
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.