lifecycle.yml

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