Code Monkey home page Code Monkey logo

stale's Introduction

Close Stale Issues and PRs

Basic validation e2e tests

Warns and then closes issues and PRs that have had no activity for a specified amount of time.

The configuration must be on the default branch and the default values will:

  • Add a label "Stale" on issues and pull requests after 60 days of inactivity and comment on them
  • Close the stale issues and pull requests after 7 days of inactivity
  • If an update/comment occur on stale issues or pull requests, the stale label will be removed and the timer will restart

Recommended permissions

For the execution of this action, it must be able to fetch all issues and pull requests from your repository.
In addition, based on the provided configuration, the action could require more permission(s) (e.g.: add label, remove label, comment, close, delete branch, etc.).
This can be achieved with the following configuration in the action if the permissions are restricted:

permissions:
  contents: write # only for delete-branch option
  issues: write
  pull-requests: write

You can find more information about the required permissions under the corresponding options that you wish to use.

Statefulness

If the action ends because of operations-per-run then the next run will start from the first unprocessed issue skipping the issues processed during the previous run(s). The state is reset when all the issues are processed. This should be considered for scheduling workflow runs.

The saved state lifetime is the same as the actions cache configured for the repo.

All options

List of input options

Every argument is optional.

Input Description Default
repo-token PAT for GitHub API authentication ${{ github.token }}
days-before-stale Idle number of days before marking issues/PRs stale 60
days-before-issue-stale Override days-before-stale for issues only
days-before-pr-stale Override days-before-stale for PRs only
days-before-close Idle number of days before closing stale issues/PRs 7
days-before-issue-close Override days-before-close for issues only
days-before-pr-close Override days-before-close for PRs only
stale-issue-message Comment on the staled issues
stale-pr-message Comment on the staled PRs
close-issue-message Comment on the staled issues while closed
close-pr-message Comment on the staled PRs while closed
stale-issue-label Label to apply on staled issues Stale
close-issue-label Label to apply on closed issues
close-issue-reason Reason to use when closing issues not_planned
stale-pr-label Label to apply on staled PRs Stale
close-pr-label Label to apply on closed PRs
exempt-issue-labels Labels on issues exempted from stale
exempt-pr-labels Labels on PRs exempted from stale
only-labels Only issues/PRs with ALL these labels are checked
only-issue-labels Override only-labels for issues only
only-pr-labels Override only-labels for PRs only
any-of-labels Only issues/PRs with ANY of these labels are checked
any-of-issue-labels Override any-of-labels for issues only
any-of-pr-labels Override any-of-labels for PRs only
operations-per-run Max number of operations per run 30
remove-stale-when-updated Remove stale label from issues/PRs on updates true
remove-issue-stale-when-updated Remove stale label from issues on updates/comments
remove-pr-stale-when-updated Remove stale label from PRs on updates/comments
labels-to-add-when-unstale Add specified labels from issues/PRs when they become unstale
labels-to-remove-when-stale Remove specified labels from issues/PRs when they become stale
labels-to-remove-when-unstale Remove specified labels from issues/PRs when they become unstale
debug-only Dry-run false
ascending Order to get issues/PRs false
start-date Skip stale action for issues/PRs created before it
delete-branch Delete branch after closing a stale PR false
exempt-milestones Milestones on issues/PRs exempted from stale
exempt-issue-milestones Override exempt-milestones for issues only
exempt-pr-milestones Override exempt-milestones for PRs only
exempt-all-milestones Exempt all issues/PRs with milestones from stale false
exempt-all-issue-milestones Override exempt-all-milestones for issues only
exempt-all-pr-milestones Override exempt-all-milestones for PRs only
exempt-assignees Assignees on issues/PRs exempted from stale
exempt-issue-assignees Override exempt-assignees for issues only
exempt-pr-assignees Override exempt-assignees for PRs only
exempt-all-assignees Exempt all issues/PRs with assignees from stale false
exempt-all-issue-assignees Override exempt-all-assignees for issues only
exempt-all-pr-assignees Override exempt-all-assignees for PRs only
exempt-draft-pr Skip the stale action for draft PRs false
enable-statistics Display statistics in the logs true
ignore-updates Any update (update/comment) can reset the stale idle time on the issues/PRs false
ignore-issue-updates Override ignore-updates for issues only
ignore-pr-updates Override ignore-updates for PRs only
include-only-assigned Process only assigned issues false

List of output options

Output Description
staled-issues-prs List of all staled issues and pull requests
closed-issues-prs List of all closed issues and pull requests

Detailed options

repo-token

Personal Access Token (PAT) that allows the stale workflow to authenticate and perform API calls to GitHub.
Under the hood, it uses the @actions/github package.

Default value: ${{ github.token }}

days-before-stale

The idle number of days before marking the issues or the pull requests as stale (by adding a label).
The issues or the pull requests will be marked as stale if the last update (based on GitHub issue field updated_at) is older than the idle number of days.
It means that any updates made, or any comments added to the issues or to the pull requests will restart the counter of days before marking as stale.
However, if you wish to ignore this behaviour so that the creation date (based on GitHub issue field created_at) only matters, you can disable the ignore-updates option.

If set to a negative number like -1, no issues or pull requests will be marked as stale automatically.
In that case, you can still add the stale label manually to mark as stale.

The label used to stale is defined by these two options:

A comment can also be added to notify about the stale and is defined by these two options:

You can fine tune which issues or pull requests should be marked as stale based on the milestones, the assignees, the creation date and the missing/present labels from these options:

Default value: 60

days-before-issue-stale

Useful to override days-before-stale but only for the idle number of days before marking the issues as stale.

Default value: unset

days-before-pr-stale

Useful to override days-before-stale but only for the idle number of days before marking the pull requests as stale.

Default value: unset

days-before-close

The idle number of days before closing the stale issues or the stale pull requests (due to the stale label).
The issues or the pull requests will be closed if the last update (based on GitHub issue field updated_at) is older than the idle number of days.
Since adding the stale label will alter the last update date, we can calculate the number of days from this date.

If set to a negative number like -1, the issues or the pull requests will never be closed automatically.

The label used to stale is defined by these two options:

Default value: 7

days-before-issue-close

Override days-before-close but only for the idle number of days before closing the stale issues.

Default value: unset

days-before-pr-close

Override days-before-close but only for the idle number of days before closing the stale pull requests.

Default value: unset

stale-issue-message

The message that will be added as a comment to the issues when the stale workflow marks it automatically as stale with a label.

You can skip the comment sending by passing an empty string.

Default value: unset
Required Permission: issues: write

stale-pr-message

The message that will be added as a comment to the pull requests when the stale workflow marks it automatically as stale with a label.

You can skip the comment sending by passing an empty string.

Default value: unset
Required Permission: pull-requests: write

close-issue-message

The message that will be added as a comment to the issues when the stale workflow closes it automatically after being stale for too long.

Default value: unset
Required Permission: issues: write

close-pr-message

The message that will be added as a comment to the pull requests when the stale workflow closes it automatically after being stale for too long.

Default value: unset
Required Permission: pull-requests: write

stale-issue-label

The label that will be added to the issues when automatically marked as stale.
If you wish to speedup the stale workflow for the issues, you can add this label manually to mark as stale.

Default value: Stale
Required Permission: issues: write

close-issue-label

The label that will be added to the issues when closed automatically.
It will be automatically removed if the issues are no longer closed nor locked.

Default value: unset
Required Permission: issues: write

close-issue-reason

Specify the reason used when closing issues. Valid values are completed and not_planned.

Default value: not_planned

stale-pr-label

The label that will be added to the pull requests when automatically marked as stale.
If you wish to speedup the stale workflow for the pull requests, you can add this label manually to mark as stale.

Default value: Stale
Required Permission: pull-requests: write

close-pr-label

The label that will be added to the pull requests when closed automatically.
It will be automatically removed if the pull requests are no longer closed nor locked.

Default value: unset
Required Permission: pull-requests: write

exempt-issue-labels

Comma separated list of labels that can be assigned to issues to exclude them from being marked as stale (e.g: question,bug)

If unset (or an empty string), this option will not alter the stale workflow.

Default value: unset

exempt-pr-labels

Comma separated list of labels that can be assigned to pull requests to exclude them from being marked as stale (e.g: need-help,WIP)

If unset (or an empty string), this option will not alter the stale workflow.

Default value: unset

only-labels

An allow-list of label(s) to only process the issues or the pull requests that contain all these label(s).
It can be a comma separated list of labels (e.g: answered,needs-rebase).

If unset (or an empty string), this option will not alter the stale workflow.

If you wish to only check that the issues or the pull requests contain one of these label(s), use instead any-of-labels.

Default value: unset

only-issue-labels

Override only-labels but only to process the issues that contain all these label(s).

Default value: unset

only-pr-labels

Override only-labels but only to process the pull requests that contain all these label(s).

Default value: unset

any-of-labels

An allow-list of label(s) to only process the issues or the pull requests that contain one of these label(s).
It can be a comma separated list of labels (e.g: answered,needs-rebase).

If unset (or an empty string), this option will not alter the stale workflow.

If you wish to only check that the issues or the pull requests contain all these label(s), use instead only-labels.

Default value: unset

any-of-issue-labels

Override any-of-labels but only to process the issues that contain one of these label(s).

Default value: unset

any-of-pr-labels

Override any-of-labels but only to process the pull requests that contain one of these label(s).

Default value: unset

operations-per-run

Context:
This action performs some API calls to GitHub to fetch or close issues and pull requests, set or update labels, add comments, delete branches, etc.
These operations are made in a very short period of time — because the action is very fast to run — and can be numerous based on your project action configuration and the quantity of issues and pull requests within it.
GitHub has a rate limit and if reached will block these API calls for one hour (or API calls from other actions using the same user (a.k.a.: the github-token from the repo-token option)).
This option helps you to stay within the GitHub rate limits, as you can use this option to limit the number of operations for a single run.

Purpose:
This option aims to limit the number of operations made with the GitHub API to avoid reaching the rate limit.

Based on your project, your GitHub business plan and the date of the cron job you set for this action, you can increase this limit to a higher number. If you are not sure which is the right value for you or if the default value is good enough, you could enable the logs and look at the end of the stale action.
If you reached the limit, you will see a warning message in the logs, telling you that you should increase the number of operations. If you choose not to increase the limit, you might end up with unprocessed issues or pull requests after a stale action run.

When debugging, you can set it to a much higher number like 1000 since there will be fewer operations made with the GitHub API.
Only the actor and the batch of issues (100 per batch) will consume the operations.

Default value: 30

remove-stale-when-updated

Automatically remove the stale label when the issues or the pull requests are updated (based on GitHub issue field updated_at) or commented.

Default value: true
Required Permission: issues: write and pull-requests: write

remove-issue-stale-when-updated

Override remove-stale-when-updated but only to automatically remove the stale label when the issues are updated (based on GitHub issue field updated_at) or commented.

Default value: unset
Required Permission: issues: write

remove-pr-stale-when-updated

Override remove-stale-when-updated but only to automatically remove the stale label when the pull requests are updated (based on GitHub issue field updated_at) or commented.

Default value: unset

labels-to-add-when-unstale

A comma delimited list of labels to add when a stale issue or pull request receives activity and has the stale-issue-label or stale-pr-label removed from it.

Default value: unset

labels-to-remove-when-stale

A comma delimited list of labels to remove when an issue or pull request becomes stale and has the stale-issue-label or stale-pr-label added to it.

Warning: each label results in a unique API call which can drastically consume the limit of operations-per-run.

Default value: unset
Required Permission: pull-requests: write

labels-to-remove-when-unstale

A comma delimited list of labels to remove when a stale issue or pull request receives activity and has the stale-issue-label or stale-pr-label removed from it.

Warning: each label results in a unique API call which can drastically consume the limit of operations-per-run.

Default value: unset
Required Permission: pull-requests: write

debug-only

Run the stale workflow as dry-run.
No GitHub API calls that can alter your issues and pull requests will happen.
Useful to debug or when you want to configure the stale workflow safely.

Default value: false

ascending

Change the order used to fetch the issues and pull requests from GitHub:

  • true is for ascending.
  • false is for descending.

It can be useful if your repository is processing so many issues and pull requests that you reach the operations-per-run limit.
Based on the order, you could prefer to focus on the new content or on the old content of your repository.

Default value: false

start-date

The start date is used to ignore the issues and pull requests created before the start date.
Particularly useful when you wish to add this stale workflow on an existing repository and only wish to stale the new issues and pull requests.

If set, the date must be formatted following the ISO 8601 or RFC 2822 standard.

Default value: unset

delete-branch

If set to true, the stale workflow will automatically delete the GitHub branches related to the pull requests automatically closed by the stale workflow.

Default value: false
Required Permission: pull-requests: write and contents: write

exempt-milestones

A white-list of milestone(s) to only process the issues or the pull requests that does not contain one of these milestone(s).
It can be a comma separated list of milestones (e.g: V1,next).

If unset (or an empty string), this option will not alter the stale workflow.

Default value: unset

exempt-issue-milestones

Override exempt-milestones but only to process the issues that does not contain one of these milestone(s).

Default value: unset

exempt-pr-milestones

Override exempt-milestones but only to process the pull requests that does not contain one of these milestone(s).

Default value: unset

exempt-all-milestones

If set to true, the issues or the pull requests with a milestone will not be marked as stale automatically.

Priority over exempt-milestones.

Default value: false

exempt-all-issue-milestones

Override exempt-all-milestones but only to exempt the issues with a milestone to be marked as stale automatically.

Default value: unset

exempt-all-pr-milestones

Override exempt-all-milestones but only to exempt the pull requests with a milestone to be marked as stale automatically.

Default value: unset

exempt-assignees

An allow-list of assignee(s) to only process the issues or the pull requests that does not contain one of these assignee(s).
It can be a comma separated list of assignees (e.g: marco,polo).

If unset (or an empty string), this option will not alter the stale workflow.

Default value: unset

exempt-issue-assignees

Override exempt-assignees but only to process the issues that does not contain one of these assignee(s).

Default value: unset

exempt-pr-assignees

Override exempt-assignees but only to process the pull requests that does not contain one of these assignee(s).

Default value: unset

exempt-all-assignees

If set to true, the issues or the pull requests with an assignee will not be marked as stale automatically.

Priority over exempt-assignees.

Default value: false

exempt-all-issue-assignees

Override exempt-all-assignees but only to exempt the issues with an assignee to be marked as stale automatically.

Default value: unset

exempt-all-pr-assignees

Override exempt-all-assignees but only to exempt the pull requests with an assignee to be marked as stale automatically.

Default value: unset

exempt-draft-pr

If set to true, the pull requests currently in draft will not be marked as stale automatically.
⚠️ This option consume one operation per pull request to process because we need to fetch the pull request with the GitHub API to know if it's a draft one or not.

Default value: false
Required Permission: pull-requests: read

enable-statistics

Collects and display statistics at the end of the stale workflow logs to get a summary of what happened during the run.
This option is only useful if the debug output secret ACTIONS_STEP_DEBUG is set to true in your repository to display the logs.

Default value: true

ignore-updates

The option days-before-stale will define the number of days before considering the issues or the pull requests as stale.
In most cases, the purpose of this action is to only stale when necessary so if any update occurs or if a comment is added to them, the counter will restart.
Nonetheless, if you don't care about this, and you prefer to stick to this number of days no matter the update, you can enable this option.
Instead of comparing the number of days based on the GitHub issue field updated_at, it will be based on the GitHub issue field created_at.

Default value: false

ignore-issue-updates

Useful to override ignore-updates but only to ignore the updates for the issues.

Default value: unset

ignore-pr-updates

Useful to override ignore-updates but only to ignore the updates for the pull requests.

Default value: unset

include-only-assigned

If set to true, only the issues or the pull requests with an assignee will be marked as stale automatically.

Default value: false

Usage

See also action.yml for a comprehensive list of all the options.

Basic:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
          stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'

Configure stale timeouts:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
          days-before-stale: 30
          days-before-close: 5

Configure different stale timeouts but never close a PR:

name: 'Close stale issues and PR'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
          stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
          close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
          days-before-stale: 30
          days-before-close: 5
          days-before-pr-close: -1

Configure different stale timeouts:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
          stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
          close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
          close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
          days-before-issue-stale: 30
          days-before-pr-stale: 45
          days-before-issue-close: 5
          days-before-pr-close: 10

Configure labels:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'Stale issue message'
          stale-pr-message: 'Stale pull request message'
          stale-issue-label: 'no-issue-activity'
          exempt-issue-labels: 'awaiting-approval,work-in-progress'
          stale-pr-label: 'no-pr-activity'
          exempt-pr-labels: 'awaiting-approval,work-in-progress'
          only-labels: 'awaiting-feedback,awaiting-answers'

Configure the stale action to only stale issue/PR created after the 18th april 2020:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          start-date: '2020-04-18T00:00:00Z' # ISO 8601 or RFC 2822

Avoid stale for specific milestones:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          exempt-issue-milestones: 'future,alpha,beta'
          exempt-pr-milestones: 'bugfix,improvement'

Avoid stale for all PR with milestones:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          exempt-all-pr-milestones: true

Check stale for specific labels:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          any-of-labels: 'needs-more-info,needs-demo'
          # You can opt for 'only-labels' instead if your use-case requires all labels
          # to be present in the issue/PR

Avoid stale for specific assignees:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          exempt-issue-assignees: 'marco,polo'
          exempt-pr-assignees: 'marco'

Avoid stale for all PR with assignees:

name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          exempt-all-pr-assignees: true

Debugging

Logs:
To see the debug output from this action, you must set the secret ACTIONS_STEP_DEBUG to true in your repository.
There are many logs, so this can be very helpful!

Statistics:
If the logs are enabled, you can also enable the statistics log which will be visible at the end of the logs once all issues were processed.
This is very helpful to have a quick understanding of the whole stale workflow.
Set enable-statistics to true in your workflow configuration file.

Dry-run:
You can run this action in debug only mode (no actions will be taken on your issues and pull requests) by passing debug-only to true as an argument to the action.

More operations:
You can increase the maximum number of operations per run by passing operations-per-run to 1000 for example which will help you to handle more operations in a single stale workflow run.
If the debug-only option is enabled, this is very helpful because the workflow will (almost) never reach the GitHub API rate, and you will be able to deep-dive into the logs.

Job frequency:
You could change the cron job frequency in the stale workflow to run the stale workflow more often.
Usually, this is not very helpful though.

Contributing

We welcome contributions! Please read the contributing file before starting your work.

stale's People

Contributors

c0zen avatar chrispat avatar cory-miller avatar dependabot[bot] avatar dsame avatar dusan-trickovic avatar e-korolevskii avatar flaxel avatar github-actions[bot] avatar hross avatar ivanzosimov avatar joannaakl avatar johnsudol avatar luketomlinson avatar maksimzhukov avatar marko-zivic-93 avatar nijel avatar nikolai-laevskii avatar panticmilos avatar parkerbxyz avatar phillipj avatar rentziass avatar romainr avatar ryanwilsonperkin avatar rylan12 avatar shawnnapora avatar smorimoto avatar thboop avatar tingluohuang avatar tobiasdiez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stale's Issues

New comments do not remove the Stale label

As raised in uber/baseweb#1892, it seems like new comments do not remove the Stale label. Do we miss anything in our configuration?

name: 'Close stale issues'
on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v1
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          stale-issue-message: "This issue is stale because it has been open 30 days with no activity. If it's still valid, please remove the stale label or comment on the issue, otherwise this ticket will be closed in 5 days"
          days-before-stale: 30
          days-before-close: 5

Issue not being closed

I have the following issue. It was marked as stale 8 days ago. But the stale bot never closed the issue.

dynamoose/dynamoose#909

GitHub Action logs (https://github.com/dynamoose/dynamoose/runs/744186714?check_suite_focus=true):

Found issue: issue #909 - [BUG] can't define a schema which includes a list of objects in typescript last updated 2020-05-30T00:26:15Z (is pr? false)
59
Found a stale issue
60
Checking for label status:stale on issue #909
61
Issue #909 marked stale on: 2020-05-30T00:26:15Z
62
Checking for comments on issue #909 since 2020-05-30T00:26:15Z
63
Comments not made by fishcharlie or another bot: 0
64
Issue #909 has been commented on: false
65
Issue #909 has been updated: true
66

Any reason why this would be occurring?

Support exempt-from-milestones

I want every pr/issue that is defined in a milestone and exempt-from-milestones is true, that this pr/issue will not get staled/closed, because if a pr/issue is already defined in a milestone it is already recognized by the team and was planned. So there is no need to close/stale it.

name: "Close stale issues"
on:
  schedule:
  - cron: "0 0 * * *"

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/stale@v1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        exempt-from-milestones: true

Add option to disable closing issues

Great project :-)!

Having a bot close issues is considered to be very rude under some circumstances so it would be great to be able to decide if this action does not close issues at all.

Something like days-before-close: -1 should serve as a flag for this and let the project maintainers/authors do any actual closing.

A workaround could be to add a very very long time to days before closing, but that does not seem like the cleanest solution.

NOT Closing issues / PRs immediately after adding the 'stale' label

Hi there,

I have a comment related the issue #28.

🙏 for having implemented this a few days ago, but I am looking for the old behavior 😅

We are introducing this action on many repos that have stale issues for a very long time.
So I was expecting the behavior as it is sated in the configuration :

days-before-close:
    description: 'The number of days to wait to close an issue or pull request after it being marked stale. Set to -1 to never close stale issues.'
    default: 7
  1. Mark the issue as stale and post a comment, which notifies the author.
  2. Then, after days-before-close close the PR that has been marked stale,

Would there be a way to get both behavior ?
May as @NBprojekt suggested with a value of 0 ?

Thanks again for your work 😄

[Enhancement] Exempt Force-Pushed updates

It would be nice to exempt Force-Pushed updates on an issue from counting as the last updated event.

Here is an example from one repo where the last "direct" update was on Aug 11, 2017, but a series of force-pushes to the branch causes the update to be May 5, 2020 (google/flatbuffers#2789). This causes this stale action to not properly tag it.

Dry Run: Testing this Action without affecting any issues or PRs

I am proposing to the Apache Spark community that we use this Action to manage the number of open PRs we have.

Enabling this Action on a large repo with so many contributors is not a single-step task. Project committers will want to see how the Action works and iterate several times on the wording of things and, more importantly, on the filter that selects which PRs to close or not.

My desired workflow is to submit a PR to the Spark repo adding this Action in. From the PR, I want to be able to iterate on the filter criteria and see what PRs would be impacted, without actually impacting anything.

Is there way to do a dry run of this Action, where we can see the list of PRs that would be impacted, along with the details of how each one would be impacted, without actually touching any PRs?

Add label when closing an issue

It would be great if this workflow would add a label, for example "wontfix" (i.e. user defined), to issues that where closed due to being stale.
If this is currently possible, please then change the title of this issue to something like: "add close label to documentation".

Ability to filter issues the stale logic should apply to

Hi.

I would love to use this action for my case, but that will require a small tweak. Specifically, I need to run the stale logic over all the issues in a specific milestone. It would be great to be able to specify milestone only for which the issues will be configured.

A more universal option would be to have a filter option (a github issue query text), which the user will specify in a workflow .yaml file, and that will flow directly into here: https://github.com/actions/stale/blob/master/src/main.ts#L33

UnhandledPromiseRejectionWarning

I got this message:

  Set up job3s
  LTS
Current runner version: '2.263.0'
Operating System
  Ubuntu
  18.04.4
  LTS
Virtual Environment
  Environment: ubuntu-18.04
  Version: 20200518.1
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200518.1/images/linux/Ubuntu1804-README.md
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/stale@v3'
  Run actions/stale@v33s
    debug-only: false
Run actions/stale@v3
  with:
    repo-token: ***
    days-before-stale: 60
    days-before-close: 7
    stale-issue-message: This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
  
    stale-pr-message: This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
  
    stale-issue-label: stale
    stale-pr-label: stale
    operations-per-run: 30
    remove-stale-when-updated: true
    debug-only: false
(node:2791) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
    at escapeData (/home/runner/work/_actions/actions/stale/v3/dist/index.js:5050:10)
    at Command.toString (/home/runner/work/_actions/actions/stale/v3/dist/index.js:5044:35)
    at issueCommand (/home/runner/work/_actions/actions/stale/v3/dist/index.js:5007:30)
    at Object.issue (/home/runner/work/_actions/actions/stale/v3/dist/index.js:5011:5)
    at Object.error (/home/runner/work/_actions/actions/stale/v3/dist/index.js:7217:15)
    at /home/runner/work/_actions/actions/stale/v3/dist/index.js:3741:18
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/actions/stale/v3/dist/index.js:3718:65)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2791) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2791) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  Complete job

Is this an error?

`only-labels` generates a warning

Hi,

I'm trying to use this github action to auto-close issues for a specific label that have had no activity in the last N days.

Here's how my configuration looks like

name: "Close stale issues"
on:
  schedule:
  - cron: "0 0 * * *"

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        only-labels: 'waiting-for-response'
        stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove label or comment or this will be closed in 2 days'
        days-before-stale: 14
        days-before-close: 2

However, it generates a warning:

Unexpected input 'only-labels', valid inputs are ['repo-token', 'stale-issue-message', 'stale-pr-message', 'days-before-stale', 'days-before-close', 'stale-issue-label', 'exempt-issue-label', 'stale-pr-label', 'exempt-pr-label', 'operations-per-run']

As per the code it seems only-labels is a valid option. What am I missing?

Enhancement: Remind requested reviewers of PRs

Rather than having the action close stale pull requests, it would be useful if the action could re-notify any requested reviewers that they have not given their review yet - ignoring any reviewer who has submitted a review or comment.

[Question] operations-per-run parameter?

What exactly is the operations-per-run parameter? I tried running this action in my repo in debug mode and got a warning "Reached max number of operations to process. Exiting." without any other output.

Stale action showing up several times in "checks"

Hi, we've just started using this action on one of our repos and I noticed that it's reporting a "check" against our commits for everything that's in an open PR. This is resulting in some PR commits as having many such "checks" against them, is there a way to avoid this?

Here's a recent example of a PR that was open over night having ~18 "checks" against it for the stale action workflow:

image

I'm concerned that this will drown out the otherwise useful checks that we're using for CI reporting on our PRs.

Stale action showing up several times in "checks"

This may relate to #13

In our PRs under the scenarios -

on:
  pull_request:
    types: [labeled, unlabeled, opened, edited, reopened, synchronize]

The checks are showing up multiple times and preventing a green due to past failed checks.

Screen Shot 2019-12-03 at 6 41 10 PM

Attempts to operate on locked issues/PRs

Locked issues/PRs cannot be commented upon without elevated user permissions. In the "Stale" Probot App, we saw that not excluding locked issues/PRs from the issues being processed led to API failure responses due to comment creation being blocked for the bot.

Easy workaround: ignore locked issues/PRs. This may not be ideal but it avoids failures and would also provide more consistent behavior with the "Stale" Probot app.

Pros and cons vs the stale bot

Out of curiosity, what are the pros and cons of this vs. the stale bot

Is it a more recent rewrite using GitHub Actions?

Are there any difference in use cases that they respectively unlock?

Option to ignore draft PRs

It would be nice to have the option to ignore draft PRs as they are implied to be not ready and can be filtered out.

Stale PRs not being closed?

We have the action with this configuration:

    steps:
      - uses: actions/stale@v1
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          days-before-stale: 13
          days-before-close: 1
          stale-pr-label: Stale
          stale-pr-message: "Pull request hasn't had any activity recently. Will be closed tomorrow if it remains like this."

The action has been running for a couple days, and yet none of the PRs marked as stale on the first day were closed on the second day:

Maybe I didn't understand how days-before-close is supposed to work, but isn't it supposed to close things 1 day after the Stale label was added?

(Just to note, there hasn't been any activity on those PRs since the action run)

Issue gets marked stale and gets closed immediately even though days-before-close has not expired

This is with the latest v3 tag using commit (b6f9559) which is the latest as of today. This is the log output from the run:

https://github.com/eclipse/omr/runs/709719104?check_suite_focus=true

There is a problem towards the end in eclipse/omr#3847:

Found issue: issue #3847 - Just-In-Time code patching framework used in CS read barrier  last updated 2019-09-13T12:54:23Z (is pr? false)
Marking issue stale because it was last updated on 2019-09-13T12:54:23Z and it does not have a stale label
Marking issue #3847 - Just-In-Time code patching framework used in CS read barrier  as stale
Found a stale issue
Checking for label stale on issue #3847
Issue #3847 marked stale on: 2020-05-26T14:44:21Z
Checking for comments on issue #3847 since 2020-05-26T14:44:21Z
Comments not made by fjeremic or another bot: 0
Issue #3847 has been commented on: false
Issue #3847 has been updated: false
Closing issue because it was last updated on 2019-09-13T12:54:23Z
Closing issue #3847 - Just-In-Time code patching framework used in CS read barrier  for being stale

The configuration on our repository can be found here:
https://github.com/eclipse/omr/blob/6367999e3f811c226a48cfa03df267ef3e561d29/.github/workflows/stale.yml

        days-before-stale: 180
        days-before-close: 60
        exempt-issue-labels: 'backlog'
        stale-issue-label: 'stale'
        stale-pr-label: 'stale'

The problem seems to be because eclipse/omr#3847 is older than 180 days, the action correctly marks it as stale on the following line:

stale/src/IssueProcessor.ts

Lines 166 to 168 in b6f9559

await this.markStale(issue, staleMessage, staleLabel);
isStale = true; // this issue is now considered stale
}

however it sets the isStale variable to true which then forces the logic on line 173 to run:

stale/src/IssueProcessor.ts

Lines 171 to 174 in b6f9559

if (isStale) {
core.info(`Found a stale ${issueType}`);
await this.processStaleIssue(issue, issueType, staleLabel);
}

Within this function we use issue.updated_at to determine whether the now stale issue should be closed:

stale/src/IssueProcessor.ts

Lines 204 to 207 in b6f9559

const issueHasUpdate: boolean = IssueProcessor.updatedSince(
issue.updated_at,
this.options.daysBeforeClose + (this.options.daysBeforeStale ?? 0)
);

However this is NOT correct since the logic on line 166 has just marked the issue as stale, and the issue.updated_at was not changed accordingly, so we proceed to close the issue without waiting for days-before-close days to pass. This is a bug in my opinion, and to fix it we should be updating the issue.updated_at if we have just marked the issue with the stale label.

Exempt specific labels from action?

For instance, we'd like to exclude issues labeled help wanted from the auto-closer, because we'd like contributors to pick these up down the line.

3.0.4 - Activity does not remove STALE flag

I'm testing out 3.0.4 and it looks like putting in a comment or mentioning an issue that is marked STALE does not remove the flag.

I'm using a stale.yaml file that looks like this:

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        days-before-stale: 1
        days-before-close: 1
        stale-issue-message: >
          Stale message goes here.
        operations-per-run: 25
        stale-pr-message: >
          Stale message goes here.
        stale-issue-label: 'STALE'
        stale-pr-label: 'STALE'
        exempt-issue-labels: 'WIP'
        exempt-pr-labels: 'WIP'
        remove-stale-when-updated: true

I created an issue that got marked stale this morning and I added a comment. Then re-ran the workflow and I see this in the output:

Found issue: issue #1 - Test Issue 1 last updated 2020-05-27T16:21:57Z (is pr? false)
Found a stale issue
Checking for label Stale on issue #1
Issue #1 marked stale on: 2020-05-27T16:21:57Z
Checking for comments on issue #1 since 2020-05-27T16:21:57Z
Comments not made by william76 or another bot: 0
Issue #1 has been commented on: false
Issue #1 has been updated: true
Stale issue is not old enough to close yet (hasComments? false, hasUpdate? true

It sees that the issue was updated, but it's not clearing the stale label. In the output I don't think the workflow is seeing the comment that I added after the issue was marked stale.

Adding a mention to a STALE issue from a PR or other issue also appears to not reset the flag.

The repository where I'm testing this is at https://github.com/william76/workflowTest/issues

Forked repos

Does this action work for PRs from forked repos?

Close issues / PRs immediately after adding the 'stale' label

The behavior I'm looking for is that a issues / PRs gets immediately closed after the 'stale' label was added.

I thought this would do the thing but it did not close the issue after adding the label, the issue got closed 1 day after the label was added.

days-before-stale: 2
days-before-close: 0

Also is there a posibility to locked the issue after it was closed?

Inspired by Ionictron, intended behavior

Support multiple exempt labels

On the stale bot, we were able to ignore a list of labels from the runs

# Only if issues that are not triaged
exemptLabels:
  - "1. to develop"
  - "2. developing"
  - "3. to review"
  - "4. to release"
  - security

Could be nice if we could as well :)

On another note, the description for the exempt-issue-label config is not really appropriate I'd say: The label to apply when an issue is exempt from being marked stale. I would go for something like The label to ignore. Any issues with that label will not be processed.

Customize bot name/avatar

Hi,

Is it possible to customize the bot's name and avatar?
Sorry if this question doesn't belong here, I've searched all around and couldn't find an answer.

Action version vs examples

Hi all! I'm trying to make use of the latest version of the action, which according to the Marketplace, is v2.0.0. However, the docs in this repo show actions/[email protected] or actions/stale@v1. Should I be using actions/stale@v2? I'd appreciate any clarification on this, thanks!

Action not run

Hi there,

good job on this action. We are using it in some of our projects and it works great.

I thought I cross-post here nevertheless as it might be from interest for you even though I don't think it is an issue with your code:

https://github.community/t5/GitHub-Actions/Action-not-run-and-no-logs-available-action-stale/m-p/42795#M5120

Summary: the action/stale is never run and no logs are available for our repository in https://github.com/comit-network/comit-rs.

source code: https://github.com/comit-network/comit-rs/blob/master/.github/workflows/stale.yml

Cheers,
Philipp

Stale bot closing after incorrect interval

Hi --

I wanted a slightly more complex workflow with the stale action that I thought would work, but doesn't appear to be. I may have misconfigured it, but it's not clear to me how; I'm hoping someone can point me in the right direction.

My desired activity is:

  1. Mark a PR stale after five days
  2. Twenty-five days after that, mark it with another label, more threatening :)
  3. Five days after that, close it.

To achieve this, I actually configured two versions of the action on the repository as follows:

.github/workflows/stale.yml:

name: Mark stale issues and pull requests
...
    - uses: actions/stale@v3
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-pr-message: "This issue has been automatically marked as stale because it has not had recent activity."
        stale-pr-label: "stale :bread:"
        days-before-stale: 3
        days-before-close: 999
        exempt-pr-labels: "On Hold :stop_sign:"

.github/workflows/closer.yml:

name: Close stale issues and pull requests
...
    - uses: actions/stale@v3
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-pr-message: "This issue will be closed soon. Please mark it 'On Hold :stop_sign:' to skip."
        stale-pr-label: "WILL BE CLOSED :skull_and_crossbones:"
        days-before-stale: 25
        days-before-close: 5
        exempt-pr-labels: "On Hold :stop_sign:"

My expectation is that a stale PR would be marked stale on day five so its updated_at would bump up, 25 days later the other action would pick it up and mark it with the new label (so its updated_at would again bump up), and then five days later it would be closed.

The first action goes as expected, and the marking of the second goes as expected -- but the closing event does not happen as expected. Here's an example log:

Found a stale pr
Checking for label WILL BE CLOSED :skull_and_crossbones: on issue #2318
Issue #2318 marked stale on: 2020-05-23T03:04:26Z
Checking for comments on issue #2318 since 2020-05-23T03:04:26Z
Comments not made by jwilner or another bot: 0
Issue #2318 has been commented on: false
Issue #2318 has been updated: true
Stale pr is not old enough to close yet (hasComments? false, hasUpdate? true

The PR was marked with WILL BE CLOSED ☠️ on 2020-05-23T03:04:26Z. Yet it's far more than five days since then and the PR has not been closed.

When I check the code here, the updatedSince logic instead seems to be waiting 30 days after the last update: https://github.com/actions/stale/blob/master/src/IssueProcessor.ts#L204-L207. I would expect this check to only be passing daysBeforeClose, not daysBeforeClose + daysBeforeStale, since adding the stale label updates the updatedAt.

Clearly though this must be working for other people, so I assume I've misconfigured something.

Any help would be greatly appreciated.

Support exempt-issue-labels/onlyLabels

Like the old stale bot, we had onlyLabels to force every issue/ to have all of the provided labels before being processed.

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels:
- "needs info"
- "0. needs triage"

Sometimes operates on issues/PRs that are already closed

For the "Stale" Probot App, we have received a fair number of reports ([1], [2], [2]) that the app was unexpected operating on issues and PRs that had already been closed. Given that our query to the Issue Search API explicitly included the is:open condition, we determined that this appears to be a more recently introduced bug or shortcoming of the Issue Search API itself -- likely due to outdated indexing.

Luckily, since we are already retrieving the list of issues to be operated on, it was easy enough to add the simple and inexpensive workaround of just checking each issue's state value to verify it was still "open" before processing it.

The same type of workaround should be included in the Stale action as well.

Issues being closed despite setting `days-before-close` to `-1`

I tried running the code below on a test repository. The issues get tagged appropriately but then they get closed despite using the days-before-close: -1 flag.

Steps to reproduce:

  1. Create new repository
  2. Add script below to .github/workflows
  3. Open a couple of test issues
  4. Wait for workflow to run
name: Mark stale issues and pull requests

on:
  schedule:
  - cron: "10 * * * *"

jobs:
  stale:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/stale@v1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-issue-message: 'This issue has not been updated in the last TBD days'
        stale-pr-message: 'This PR has not been updated in the last TBD days'
        stale-issue-label: 'stale'
        stale-pr-label: 'stale'
        days-before-stale: 0
        days-before-close: -1

Option to only mark issues with a certain tag

It'd be nice to have an option to only run on a certain label (the opposite of exempt-issue-label), for example to only process issues labelled as question. Of course this should be implemented for PRs as well.

Do you have to close PRs/Issues?

So since discussions isn't enabled yet for this repo, I shall ask my question here... Is there a way to have this action just mark something a stale but not close the PR or issue? Often times people open an issue and there is no follow up, but we also don't want to close the issue because they haven't gotten back to following up in a certain amount of time. It looks like the closing is required

daysBeforeClose: parseInt(
    core.getInput('days-before-close', {required: true})
),

Would there be any opposition to not making this required? Furthermore, would there be any opposition to making the marking of stale and closing different between issues and PRs? For example, maybe someone wants to close a PR immediately after being marked as stale but might want to close an issue 2 days after.

Do mentions count as activity?

Does a mention from another issue or pull request count as activity on an issue and reset the inactivity counter?

For example:

  • Workflow marks issues as inactive after 5 days
  • Issue A is filed on Jan 1
  • Issue B is filed on Jan 4 and mentions issue A in it.

If Issue A is otherwise not touched, would it get flagged as stale on Jan 5th or 9th?

If the answer is Jan 5th... it would be useful to have an option in the yaml, say include-mentions-as-activity or something like that so that if an issue is mentioned in a PR or another issue the stale timer would get reset for that issue.

Add an option to skip adding a comment while marking issue / pr as stale

Description

Currently there's no option for not adding a comment while marking an issue or a pull request as stale. As a real life example use case, a bot on fastlane repository only adds a label status: needs-attention to the pull requests that have been hanging without any action for a while. It's a handy way to express the need for an action to be taken without an explicitly pinging a given person.

Proposal

I'd like to propose adding two parameters to the action's inteface:

skip-stale-pr-message:
  description: 'Skip adding stale message when marking a pull request as stale.'
  default: false

skip-stale-issue-message:
  description: 'Skip adding stale message when marking an issue as stale.'
  default: false

No breaking changes, only opt-in.

Empty stale-pr-message / stale-issue-message will always take a precedence over skip-stale-pr-message / skip-stale-issue-message.

Workaround

Create a custom GitHub Action based on an official stale action implementation.

I'll gladly implement this feature if a proposal is accepted 😊

Only mark as stale once a comment is added

It would be a useful feature to be able to only mark issues as stale once another user has added at least one comment in response, for example where issues are used to ask questions about a repository.

Add testing

We really need units (so far have just been using integration tests)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.