Merge branch 'main' into apply-reusable-workflows
This commit is contained in:
commit
5325f2f14e
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,5 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# [7.0.0]
|
||||||
|
|
||||||
|
:warning: Breaking change :warning:
|
||||||
|
|
||||||
|
* Allow daysBeforeStale options to be float by @irega in https://github.com/actions/stale/pull/841
|
||||||
|
* Use cache in check-dist.yml by @jongwooo in https://github.com/actions/stale/pull/876
|
||||||
|
* fix print outputs step in existing workflows by @irega in https://github.com/actions/stale/pull/859
|
||||||
|
* Update issue and PR templates, add/delete workflow files by @IvanZosimov in https://github.com/actions/stale/pull/880
|
||||||
|
* Update how stale handles exempt items by @johnsudol in https://github.com/actions/stale/pull/874
|
||||||
|
|
||||||
# [6.0.1]
|
# [6.0.1]
|
||||||
|
|
||||||
Update @actions/core to v1.10.0 ([#839](https://github.com/actions/stale/pull/839))
|
Update @actions/core to v1.10.0 ([#839](https://github.com/actions/stale/pull/839))
|
||||||
|
|
|
@ -246,8 +246,8 @@ Required Permission: `pull-requests: write`
|
||||||
|
|
||||||
#### exempt-issue-labels
|
#### exempt-issue-labels
|
||||||
|
|
||||||
The label(s) that can exempt to automatically mark as stale the issues.
|
Comma separated list of labels that can be assigned to issues to exclude them from being marked as stale
|
||||||
It can be a comma separated list of labels (e.g: `question,bug`).
|
(e.g: `question,bug`)
|
||||||
|
|
||||||
If unset (or an empty string), this option will not alter the stale workflow.
|
If unset (or an empty string), this option will not alter the stale workflow.
|
||||||
|
|
||||||
|
@ -255,8 +255,8 @@ Default value: unset
|
||||||
|
|
||||||
#### exempt-pr-labels
|
#### exempt-pr-labels
|
||||||
|
|
||||||
The label(s) that can exempt to automatically mark as stale the pull requests.
|
Comma separated list of labels that can be assigned to pull requests to exclude them from being marked as stale
|
||||||
It can be a comma separated list of labels (e.g: `need-help,WIP`).
|
(e.g: `need-help,WIP`)
|
||||||
|
|
||||||
If unset (or an empty string), this option will not alter the stale workflow.
|
If unset (or an empty string), this option will not alter the stale workflow.
|
||||||
|
|
||||||
|
|
|
@ -1094,44 +1094,6 @@ test('exempt pr labels will not be marked stale', async () => {
|
||||||
expect(processor.staleIssues).toHaveLength(2); // PR should get processed even though it has an exempt **issue** label
|
expect(processor.staleIssues).toHaveLength(2); // PR should get processed even though it has an exempt **issue** label
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exempt issue labels will not be marked stale and will remove the existing stale label', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
const opts = {...DefaultProcessorOptions};
|
|
||||||
opts.exemptIssueLabels = 'Exempt';
|
|
||||||
const TestIssueList: Issue[] = [
|
|
||||||
generateIssue(
|
|
||||||
opts,
|
|
||||||
1,
|
|
||||||
'My first issue',
|
|
||||||
'2020-01-01T17:00:00Z',
|
|
||||||
'2020-01-01T17:00:00Z',
|
|
||||||
false,
|
|
||||||
['Exempt', 'Stale']
|
|
||||||
)
|
|
||||||
];
|
|
||||||
const processor = new IssuesProcessorMock(
|
|
||||||
opts,
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
|
||||||
async () => [
|
|
||||||
{
|
|
||||||
user: {
|
|
||||||
login: 'notme',
|
|
||||||
type: 'User'
|
|
||||||
},
|
|
||||||
body: 'Body'
|
|
||||||
}
|
|
||||||
], // return a fake comment to indicate there was an update
|
|
||||||
async () => new Date().toDateString()
|
|
||||||
);
|
|
||||||
|
|
||||||
// process our fake issue list
|
|
||||||
await processor.processIssues(1);
|
|
||||||
|
|
||||||
expect(processor.staleIssues.length).toStrictEqual(0);
|
|
||||||
expect(processor.closedIssues.length).toStrictEqual(0);
|
|
||||||
expect(processor.removedLabelIssues.length).toStrictEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('stale issues should not be closed if days is set to -1', async () => {
|
test('stale issues should not be closed if days is set to -1', async () => {
|
||||||
const opts = {...DefaultProcessorOptions};
|
const opts = {...DefaultProcessorOptions};
|
||||||
opts.daysBeforeClose = -1;
|
opts.daysBeforeClose = -1;
|
||||||
|
|
|
@ -523,20 +523,17 @@ class IssuesProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`This $$type has a stale label`);
|
issueLogger.info(`This $$type includes a stale label`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
issueLogger.info(`This $$type hasn't a stale label`);
|
issueLogger.info(`This $$type does not include a stale label`);
|
||||||
}
|
}
|
||||||
const exemptLabels = words_to_list_1.wordsToList(issue.isPullRequest
|
const exemptLabels = words_to_list_1.wordsToList(issue.isPullRequest
|
||||||
? this.options.exemptPrLabels
|
? this.options.exemptPrLabels
|
||||||
: this.options.exemptIssueLabels);
|
: this.options.exemptIssueLabels);
|
||||||
if (exemptLabels.some((exemptLabel) => is_labeled_1.isLabeled(issue, exemptLabel))) {
|
const hasExemptLabel = exemptLabels.some((exemptLabel) => is_labeled_1.isLabeled(issue, exemptLabel));
|
||||||
if (issue.isStale) {
|
if (hasExemptLabel) {
|
||||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
issueLogger.info(`Skipping this $$type because it contains an exempt label, see ${issueLogger.createOptionLink(issue.isPullRequest ? option_1.Option.ExemptPrLabels : option_1.Option.ExemptIssueLabels)} for more details`);
|
||||||
yield this._removeStaleLabel(issue, staleLabel);
|
|
||||||
}
|
|
||||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
|
||||||
IssuesProcessor._endIssueProcessing(issue);
|
IssuesProcessor._endIssueProcessing(issue);
|
||||||
return; // Don't process exempt issues
|
return; // Don't process exempt issues
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "stale-action",
|
"name": "stale-action",
|
||||||
"version": "2.0.0",
|
"version": "7.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "stale-action",
|
"name": "stale-action",
|
||||||
"version": "2.0.0",
|
"version": "7.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "stale-action",
|
"name": "stale-action",
|
||||||
"version": "2.0.0",
|
"version": "7.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Marks old issues and PRs as stale",
|
"description": "Marks old issues and PRs as stale",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|
|
@ -321,9 +321,9 @@ export class IssuesProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`This $$type has a stale label`);
|
issueLogger.info(`This $$type includes a stale label`);
|
||||||
} else {
|
} else {
|
||||||
issueLogger.info(`This $$type hasn't a stale label`);
|
issueLogger.info(`This $$type does not include a stale label`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptLabels: string[] = wordsToList(
|
const exemptLabels: string[] = wordsToList(
|
||||||
|
@ -332,17 +332,16 @@ export class IssuesProcessor {
|
||||||
: this.options.exemptIssueLabels
|
: this.options.exemptIssueLabels
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
const hasExemptLabel = exemptLabels.some((exemptLabel: Readonly<string>) =>
|
||||||
exemptLabels.some((exemptLabel: Readonly<string>): boolean =>
|
isLabeled(issue, exemptLabel)
|
||||||
isLabeled(issue, exemptLabel)
|
);
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (issue.isStale) {
|
|
||||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
|
||||||
await this._removeStaleLabel(issue, staleLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
if (hasExemptLabel) {
|
||||||
|
issueLogger.info(
|
||||||
|
`Skipping this $$type because it contains an exempt label, see ${issueLogger.createOptionLink(
|
||||||
|
issue.isPullRequest ? Option.ExemptPrLabels : Option.ExemptIssueLabels
|
||||||
|
)} for more details`
|
||||||
|
);
|
||||||
IssuesProcessor._endIssueProcessing(issue);
|
IssuesProcessor._endIssueProcessing(issue);
|
||||||
return; // Don't process exempt issues
|
return; // Don't process exempt issues
|
||||||
}
|
}
|
||||||
|
@ -427,6 +426,7 @@ export class IssuesProcessor {
|
||||||
// Determine if this issue needs to be marked stale first
|
// Determine if this issue needs to be marked stale first
|
||||||
if (!issue.isStale) {
|
if (!issue.isStale) {
|
||||||
issueLogger.info(`This $$type is not stale`);
|
issueLogger.info(`This $$type is not stale`);
|
||||||
|
|
||||||
const shouldIgnoreUpdates: boolean = new IgnoreUpdates(
|
const shouldIgnoreUpdates: boolean = new IgnoreUpdates(
|
||||||
this.options,
|
this.options,
|
||||||
issue
|
issue
|
||||||
|
|
Loading…
Reference in New Issue