1name: lifecycle
  2
  3on:
  4  issues:
  5    types:
  6      - assigned
  7      - closed
  8      - demilestoned
  9      - milestoned
 10      - pinned
 11      - unpinned
 12      - reopened
 13  issue_comment:
 14    types:
 15      - created
 16  pull_request:
 17    types:
 18      - assigned
 19      - auto_merge_enabled
 20      - converted_to_draft
 21      - demilestoned
 22      - enqueued
 23      - milestoned
 24      - ready_for_review
 25      - reopened
 26      - synchronize
 27  pull_request_review:
 28    types:
 29      - submitted
 30      - dismissed
 31  schedule:
 32    - cron: '17 3 * * *' # every day at 03:17 UTC
 33
 34concurrency:
 35  group: lifecycle-${{ github.event.issue.number || github.event.pull_request.number || 'scheduled' }}
 36  cancel-in-progress: false
 37
 38jobs:
 39  auto-label:
 40    name: auto-label
 41    if: github.event_name != 'schedule'
 42    runs-on: ubuntu-latest
 43    permissions:
 44      contents: read
 45      issues: write
 46      pull-requests: write
 47    steps:
 48      - uses: actions/checkout@v4
 49        with:
 50          sparse-checkout: |
 51            .github/actions
 52
 53      - name: "add label for pinned or milestoned item: lifecycle/pinned"
 54        if: github.event.action == 'pinned' || github.event.action == 'milestoned'
 55        uses: ./.github/actions/auto-label
 56        env:
 57          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 58        with:
 59          add: lifecycle/pinned
 60          remove: |
 61            lifecycle/idle
 62            lifecycle/dormant
 63
 64      - name: "remove label for unpinned or demilestoned item: lifecycle/pinned"
 65        if: github.event.action == 'unpinned' || github.event.action == 'demilestoned'
 66        uses: ./.github/actions/auto-label
 67        env:
 68          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 69        with:
 70          remove: lifecycle/pinned
 71
 72      - name: "remove lifecycle label due to activity"
 73        if: github.event.action != 'pinned' && github.event.action != 'milestoned'
 74        uses: ./.github/actions/auto-label
 75        env:
 76          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 77        with:
 78          remove: |
 79            lifecycle/idle
 80            lifecycle/dormant
 81
 82  idle-sweeper:
 83    name: idle-sweeper
 84    if: github.event_name == 'schedule'
 85    runs-on: ubuntu-latest
 86    permissions:
 87      issues: write
 88      pull-requests: write
 89    env:
 90      ISSUE_MESSAGE_DETAILS: |
 91        <br /><strong>Issues will <em>not</em> be automatically closed due to
 92        inactivity.</strong>
 93        <hr />
 94        <details>
 95        <summary>Learn more</summary>
 96
 97        This bot triages issues in order to help the maintainers identify what
 98        needs attention, according to the following lifecycle rules:
 99
100        - After 90 days of inactivity, <code>lifecycle/idle</code> is applied
101        - After 180 days of inactivity, <code>lifecycle/dormant</code> is applied
102
103        The following actions remove the inactive status:
104
105        - Removing the <code>lifecycle/*</code> label from this issue
106        - Commenting on this issue
107        - Adding a new assignee to this issue
108        - Reopening this issue
109        - Adding this issue to a milestone
110        - Pinning this issue to the top of the issue board
111
112        To avoid automatic lifecycle management of this issue, maintainers can
113        add the <code>lifecycle/pinned</code> label.
114        </details>
115      PR_MESSAGE_DETAILS: |
116        <br /><strong>Pull requests will <em>not</em> be closed automatically
117        due to inactivity.</strong>
118
119        <details>
120        <summary>Learn more</summary>
121        This bot triages pull requests in order to help the maintainers identify
122        what needs attention, according to the following lifecycle rules:
123
124        - After 90 days of inactivity, <code>lifecycle/idle</code> is applied
125        - After 90 days of inactivity, <code>lifecycle/dormant</code> is applied
126
127        The following actions remove the inactive status:
128
129        - Removing the <code>lifecycle/*</code> label from this pull request
130        - Commenting on this pull request
131        - Submitting a review for this pull request
132        - Adding a new assignee to this pull request
133        - Reopening this pull request
134        - Adding this pull request to a milestone
135        - Converting this pull request to a draft
136        - Setting this pull request as "ready to review" (not a draft)
137        - Enabling auto-merge, or adding this pull request to the merge queue
138
139        To avoid automatic lifecycle management of this pull request,
140        maintainers can add the <code>lifecycle/pinned</code> label.
141        </details>
142    steps:
143      - name: "inactivity check: 90 days"
144        uses: actions/stale@v9
145        with:
146          days-before-close: -1
147          days-before-stale: 90
148          exempt-all-milestones: true
149          exempt-issue-labels: lifecycle/idle,lifecycle/dormant,lifecycle/pinned
150          exempt-pr-labels: lifecycle/idle,lifecycle/dormant,lifecycle/pinned
151          labels-to-remove-when-stale: lifecycle/active
152          stale-issue-label: lifecycle/idle
153          stale-issue-message: |
154            Pinging maintainers. This issue has been inactive for 90 days.
155            ${{ env.ISSUE_MESSAGE_DETAILS }}
156          stale-pr-label: lifecycle/idle
157          stale-pr-message: |
158            Pinging maintainers. This pull request has been inactive for 90 days.
159            ${{ env.PR_MESSAGE_DETAILS }}
160
161      - name: "inactivity check: 180 days"
162        uses: actions/stale@v9
163        with:
164          days-before-close: -1
165          days-before-stale: 180
166          exempt-all-milestones: true
167          labels-to-remove-when-stale: lifecycle/idle
168          only-labels: lifecycle/idle
169          stale-issue-label: lifecycle/dormant
170            Pinging maintainers. This issue has been inactive for 180 days.
171            ${{ env.ISSUE_MESSAGE_DETAILS }}
172          stale-pr-label: lifecycle/dormant
173          stale-pr-message: |
174            Pinging maintainers. This pull request has been inactive for 180 days.
175            ${{ env.PR_MESSAGE_DETAILS }}