lifecycle.yml

  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/auto-label
 52
 53      - name: "restore cache: node modules"
 54        uses: actions/cache@v4
 55        with:
 56          path: .github/actions/auto-label/node_modules
 57          key: auto-label-${{ runner.os }}-${{ hashFiles('.github/actions/auto-label/package-lock.json') }}
 58          restore-keys: |
 59            auto-label-${{ runner.os }}-
 60
 61      - name: "install dependencies for //.github/actions/auto-label"
 62        working-directory: .github/actions/auto-label
 63        run: npm ci
 64
 65      - name: "add label for pinned or milestoned item: lifecycle/pinned"
 66        if: github.event.action == 'pinned' || github.event.action == 'milestoned'
 67        uses: ./.github/actions/auto-label
 68        env:
 69          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 70        with:
 71          add: lifecycle/pinned
 72          remove: |
 73            lifecycle/idle
 74            lifecycle/dormant
 75
 76      - name: "remove label for unpinned or demilestoned item: lifecycle/pinned"
 77        if: github.event.action == 'unpinned' || github.event.action == 'demilestoned'
 78        uses: ./.github/actions/auto-label
 79        env:
 80          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 81        with:
 82          remove: lifecycle/pinned
 83
 84      - name: "remove lifecycle label due to activity"
 85        if: github.event.action != 'pinned' && github.event.action != 'milestoned'
 86        uses: ./.github/actions/auto-label
 87        env:
 88          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 89        with:
 90          remove: |
 91            lifecycle/idle
 92            lifecycle/dormant
 93
 94  idle-sweeper:
 95    name: idle-sweeper
 96    if: github.event_name == 'schedule'
 97    runs-on: ubuntu-latest
 98    permissions:
 99      issues: write
100      pull-requests: write
101    env:
102      ISSUE_MESSAGE_DETAILS: |
103        <br /><strong>Issues will <em>not</em> be automatically closed due to
104        inactivity.</strong>
105        <hr />
106        <details>
107        <summary>Learn more</summary>
108
109        This bot triages issues in order to help the maintainers identify what
110        needs attention, according to the following lifecycle rules:
111
112        - After 90 days of inactivity, <code>lifecycle/idle</code> is applied
113        - After 180 days of inactivity, <code>lifecycle/dormant</code> is applied
114
115        The following actions remove the inactive status:
116
117        - Removing the <code>lifecycle/*</code> label from this issue
118        - Commenting on this issue
119        - Adding a new assignee to this issue
120        - Reopening this issue
121        - Adding this issue to a milestone
122        - Pinning this issue to the top of the issue board
123
124        To avoid automatic lifecycle management of this issue, maintainers can
125        add the <code>lifecycle/pinned</code> label.
126        </details>
127      PR_MESSAGE_DETAILS: |
128        <br /><strong>Pull requests will <em>not</em> be closed automatically
129        due to inactivity.</strong>
130
131        <details>
132        <summary>Learn more</summary>
133        This bot triages pull requests in order to help the maintainers identify
134        what needs attention, according to the following lifecycle rules:
135
136        - After 90 days of inactivity, <code>lifecycle/idle</code> is applied
137        - After 90 days of inactivity, <code>lifecycle/dormant</code> is applied
138
139        The following actions remove the inactive status:
140
141        - Removing the <code>lifecycle/*</code> label from this pull request
142        - Commenting on this pull request
143        - Submitting a review for this pull request
144        - Adding a new assignee to this pull request
145        - Reopening this pull request
146        - Adding this pull request to a milestone
147        - Converting this pull request to a draft
148        - Setting this pull request as "ready to review" (not a draft)
149        - Enabling auto-merge, or adding this pull request to the merge queue
150
151        To avoid automatic lifecycle management of this pull request,
152        maintainers can add the <code>lifecycle/pinned</code> label.
153        </details>
154    steps:
155      - name: "inactivity check: 90 days"
156        uses: actions/stale@v9
157        with:
158          days-before-close: -1
159          days-before-stale: 90
160          exempt-all-milestones: true
161          exempt-issue-labels: lifecycle/idle,lifecycle/dormant,lifecycle/pinned
162          exempt-pr-labels: lifecycle/idle,lifecycle/dormant,lifecycle/pinned
163          labels-to-remove-when-stale: lifecycle/active
164          stale-issue-label: lifecycle/idle
165          stale-issue-message: |
166            Pinging maintainers. This issue has been inactive for 90 days.
167            ${{ env.ISSUE_MESSAGE_DETAILS }}
168          stale-pr-label: lifecycle/idle
169          stale-pr-message: |
170            Pinging maintainers. This pull request has been inactive for 90 days.
171            ${{ env.PR_MESSAGE_DETAILS }}
172
173      - name: "inactivity check: 180 days"
174        uses: actions/stale@v9
175        with:
176          days-before-close: -1
177          days-before-stale: 180
178          exempt-all-milestones: true
179          labels-to-remove-when-stale: lifecycle/idle
180          only-labels: lifecycle/idle
181          stale-issue-label: lifecycle/dormant
182            Pinging maintainers. This issue has been inactive for 180 days.
183            ${{ env.ISSUE_MESSAGE_DETAILS }}
184          stale-pr-label: lifecycle/dormant
185          stale-pr-message: |
186            Pinging maintainers. This pull request has been inactive for 180 days.
187            ${{ env.PR_MESSAGE_DETAILS }}