fix: resolve audit vulnerabilities (#1374)
Co-authored-by: HarithaVattikuti 73516759+HarithaVattikuti@users.noreply.github.com Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Close Stale Issues and PRs
What’s changed in V11
@actions/*package versions. No changes to action inputs, outputs, or behavior.Breaking changes in V10
For more details, see the full release notes on the release page
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:
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:
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.
${{ github.token }}607Stalenot_plannedStale30truefalsefalsefalsefalsefalsefalsetruefalsefalsecreatedList of output options
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:
60days-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:
7days-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: writestale-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: writeclose-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: writeclose-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: writestale-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:
StaleRequired Permission:
issues: writeclose-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: writeclose-issue-reason
Specify the reason used when closing issues. Valid values are
completedandnot_planned.Default value:
not_plannedstale-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:
StaleRequired Permission:
pull-requests: writeclose-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: writeexempt-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
1000since 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:
30remove-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:
trueRequired Permission:
issues: writeandpull-requests: writeremove-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: writeremove-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: writelabels-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: writedebug-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:
falseascending
Change the order used to fetch the issues and pull requests from GitHub:
trueis for ascending.falseis 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:
falsestart-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 8601orRFC 2822standard.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:
falseRequired Permission:
pull-requests: writeandcontents: writeexempt-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:
falseexempt-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:
falseexempt-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:
falseRequired Permission:
pull-requests: readenable-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_DEBUGis set totruein your repository to display the logs.Default value:
trueignore-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 fieldcreated_at.Default value:
falseignore-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:
falsesort-by
Useful to sort the issues and PRs by the specified field. It accepts
created,updated,comments.Default value:
createdexempt-issue-types
A comma separated list of issue types that can be assigned to issues to exclude them from being marked as stale (e.g:
Bug,Feature)If unset (or an empty string), this option will not alter the stale workflow.
If a type is listed in both
exempt-issue-typesandonly-issue-types,exempt-issue-typestakes precedence.Default value: unset
only-issue-types
A comma separated list of allowed issue types. Only issues with a matching type will be processed (e.g.:
bug,question).If unset (or an empty string), this option will not alter the stale workflow.
This option does not affect PRs.
Default value: unset
Usage
See also action.yml for a comprehensive list of all the options.
Basic:
Configure stale timeouts:
Configure different stale timeouts but never close a PR:
Configure different stale timeouts:
Configure labels:
Configure the stale action to only stale issue/PR created after the 18th april 2020:
Avoid stale for specific milestones:
Avoid stale for all PR with milestones:
Check stale for specific labels:
Avoid stale for specific assignees:
Avoid stale for all PR with assignees:
Debugging
Logs:
To see the debug output from this action, you must set the secret
ACTIONS_STEP_DEBUGtotruein 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-statisticstotruein 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-onlytotrueas an argument to the action.More operations:
You can increase the maximum number of operations per run by passing
operations-per-runto1000for example which will help you to handle more operations in a single stale workflow run.If the
debug-onlyoption 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.