| 1 |
name: Stale |
| 2 |
|
| 3 |
on: |
| 4 |
# NOTE: github.event is workflow_dispatch payload: |
| 5 |
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch |
| 6 |
workflow_dispatch: |
| 7 |
inputs: |
| 8 |
dryrun: |
| 9 |
description: 'dryrun: Preview stale issues/prs without marking them (true|false)' |
| 10 |
required: true |
| 11 |
type: boolean |
| 12 |
default: true |
| 13 |
|
| 14 |
schedule: |
| 15 |
- cron: 0 4 * * * |
| 16 |
|
| 17 |
concurrency: |
| 18 |
group: ${{ github.workflow }}-${{ github.repository }} |
| 19 |
cancel-in-progress: true |
| 20 |
|
| 21 |
permissions: |
| 22 |
contents: read |
| 23 |
|
| 24 |
jobs: |
| 25 |
stale: |
| 26 |
name: Mark stale threads |
| 27 |
if: '!github.event.repository.fork' |
| 28 |
runs-on: ubuntu-slim |
| 29 |
permissions: |
| 30 |
issues: write # Required to mark and close stale issues. |
| 31 |
pull-requests: write # Required to mark and close stale pull requests. |
| 32 |
strategy: |
| 33 |
matrix: |
| 34 |
include: |
| 35 |
- only-issue-labels: '' |
| 36 |
days-before-issue-stale: 365 |
| 37 |
days-before-issue-close: 30 |
| 38 |
# [type::support] issues have a more aggressive stale/close timeline |
| 39 |
- only-issue-labels: type::support |
| 40 |
days-before-issue-stale: 90 |
| 41 |
days-before-issue-close: 21 |
| 42 |
steps: |
| 43 |
- uses: conda/actions/read-file@d88418cd4e36358ba51e7c88f2d2d5edb9ac49e7 # v26.8.1 |
| 44 |
id: read_messages |
| 45 |
with: |
| 46 |
path: https://raw.githubusercontent.com/conda/infra/main/.github/messages.yml |
| 47 |
parser: yaml |
| 48 |
|
| 49 |
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0 |
| 50 |
id: stale |
| 51 |
with: |
| 52 |
# Only issues with these labels are checked whether they are stale |
| 53 |
only-issue-labels: ${{ matrix.only-issue-labels }} |
| 54 |
|
| 55 |
# Idle number of days before marking issues stale |
| 56 |
days-before-issue-stale: ${{ matrix.days-before-issue-stale }} |
| 57 |
# Idle number of days before closing stale issues/PRs |
| 58 |
days-before-issue-close: ${{ matrix.days-before-issue-close }} |
| 59 |
# Idle number of days before marking PRs stale |
| 60 |
days-before-pr-stale: 365 |
| 61 |
# Idle number of days before closing stale PRs |
| 62 |
days-before-pr-close: 30 |
| 63 |
|
| 64 |
# Comment on the staled issues |
| 65 |
stale-issue-message: ${{ fromJSON(steps.read_messages.outputs.content)['stale-issue'] }} |
| 66 |
# Label to apply on staled issues |
| 67 |
stale-issue-label: stale |
| 68 |
# Label to apply on closed issues |
| 69 |
close-issue-label: stale::closed |
| 70 |
# Reason to use when closing issues |
| 71 |
close-issue-reason: not_planned |
| 72 |
|
| 73 |
# Comment on the staled PRs |
| 74 |
stale-pr-message: ${{ fromJSON(steps.read_messages.outputs.content)['stale-pr'] }} |
| 75 |
# Label to apply on staled PRs |
| 76 |
stale-pr-label: stale |
| 77 |
# Label to apply on closed PRs |
| 78 |
close-pr-label: stale::closed |
| 79 |
|
| 80 |
# Remove stale label from issues/PRs on updates/comments |
| 81 |
remove-stale-when-updated: true |
| 82 |
# Add specified labels to issues/PRs when they become unstale |
| 83 |
labels-to-add-when-unstale: stale::recovered |
| 84 |
# Remove specified labels to issues/PRs when they become unstale |
| 85 |
labels-to-remove-when-unstale: stale,stale::closed |
| 86 |
|
| 87 |
# Max number of operations per run |
| 88 |
operations-per-run: ${{ secrets.STALE_OPERATIONS_PER_RUN || 100 }} |
| 89 |
# Dry-run |
| 90 |
debug-only: ${{ github.event.inputs.dryrun || false }} |
| 91 |
# Order to get issues/PRs |
| 92 |
ascending: true |
| 93 |
# Delete branch after closing a stale PR |
| 94 |
delete-branch: false |
| 95 |
|
| 96 |
# Issues with these labels will never be considered stale |
| 97 |
exempt-issue-labels: stale::recovered,epic |
| 98 |
# Issues with these labels will never be considered stale |
| 99 |
exempt-pr-labels: stale::recovered,epic |
| 100 |
# Exempt all issues/PRs with milestones from stale |
| 101 |
exempt-all-milestones: true |
| 102 |
# Assignees on issues/PRs exempted from stale |
| 103 |
exempt-assignees: mingwandroid |
| 104 |
|
| 105 |
- name: Print outputs |
| 106 |
run: echo ${{ join(steps.stale.outputs.*, ',') }} |