Skip to content

Stale issues & PRs handler #1615

Stale issues & PRs handler

Stale issues & PRs handler #1615

Workflow file for this run

# Summary: perform scheduled handling of stale issues and PRs.
# For more info, see https://github.com/actions/stale/.
name: "Stale issues & PRs handler"
on:
schedule:
- cron: '0 0 * * *'
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:
# We set variables for the duration values here, so that they can be used
# in issue messages instead of hardcoding the values all over the place.
days-before-stale: 90
days-before-close: 60
# The syntax for actions/stale uses a comma-separated list of labels, but
# it's hard to read and convenient to edit in that format. We can use a
# normal YAML list and convert it later.
exempt-issue-labels-list:
kind/design-issue
kind/health
kind/roadmap-item
kind/task
triage/accepted
triage/discuss
exempt-pr-labels-list:
kind/roadmap-item
triage/accepted
# Declare default permissions as read only.
permissions: read-all
jobs:
stale:
name: Label and/or close stale issues and PRs
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
issues: write
pull-requests: write
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: 'status/stale'
stale-pr-label: 'status/stale'
close-issue-label: 'status/stale'
close-pr-label: 'status/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].