Skip to content

Ability to ignore label changes as "updates" #1301

@douglasg14b

Description

@douglasg14b

Description:

A way to ignore labeling as an "update". When the action adds a stale label to a PR, that PR is now considered "updated" as of that time, and is no longer stale during the next run.

Justification:

Trying to have cascading stale levels, however, when a stale label is added the PR is now considered "updated" and no longer stale on the next run, removing that stale level on the next run.

Are you willing to submit a PR?

Unsure, I wouldn't know where to start here.


Example workflow:

name: Stale PR Management

permissions:
    issues: write
    pull-requests: write

on:
    pull_request:
        types: [opened]
    schedule:
        - cron: '0 * * * *' # Runs every hour
    workflow_dispatch:

jobs:
    label-new-prs:
        runs-on: ubuntu-latest
        if: github.event_name == 'pull_request' && github.event.action == 'opened'
        steps:
            - uses: actions/github-script@v8
              with:
                  script: |
                      await github.rest.issues.addLabels({
                        owner: context.repo.owner,
                        repo: context.repo.repo,
                        issue_number: context.issue.number,
                        labels: ['🌱 fresh']
                      });

    mark-relic:
        runs-on: ubuntu-latest
        if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
        steps:
            - uses: actions/stale@v9
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  days-before-stale: 15
                  days-before-close: -1
                  days-before-issue-stale: -1
                  stale-pr-label: '🗿 relic'
                  labels-to-remove-when-unstale: '🗿 relic'
                  labels-to-remove-when-stale: '🌱 fresh,🍞 stale'
                  exempt-pr-labels: ''
                  operations-per-run: 100

    mark-stale:
        runs-on: ubuntu-latest
        if: github.event_name == 'schedule'  || github.event_name == 'workflow_dispatch'
        needs: mark-relic
        steps:
            - uses: actions/stale@v9
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  days-before-stale: 7
                  days-before-close: -1
                  days-before-issue-stale: -1
                  stale-pr-label: '🍞 stale'
                  labels-to-add-when-unstale: '🌱 fresh'
                  labels-to-remove-when-unstale: '🗿 relic,🍞 stale'
                  labels-to-remove-when-stale: '🌱 fresh'
                  exempt-pr-labels: '🗿 relic'
                  operations-per-run: 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions