feat: remove the ignore-updates option
BREAKING CHANGE: The option ignore-updates was removed
This commit is contained in:
parent
b98591d49e
commit
3021a55a47
26
README.md
26
README.md
|
@ -29,7 +29,7 @@ You can find more information about the required permissions under the correspon
|
||||||
Every argument is optional.
|
Every argument is optional.
|
||||||
|
|
||||||
| Input | Description | Default |
|
| Input | Description | Default |
|
||||||
| ------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------- |
|
| ------------------------------------------------------------------- | ------------------------------------------------------------------------ | --------------------- |
|
||||||
| [repo-token](#repo-token) | PAT for GitHub API authentication | `${{ github.token }}` |
|
| [repo-token](#repo-token) | PAT for GitHub API authentication | `${{ github.token }}` |
|
||||||
| [days-before-stale](#days-before-stale) | Idle number of days before marking issues/PRs stale | `60` |
|
| [days-before-stale](#days-before-stale) | Idle number of days before marking issues/PRs stale | `60` |
|
||||||
| [days-before-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | |
|
| [days-before-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | |
|
||||||
|
@ -77,9 +77,8 @@ Every argument is optional.
|
||||||
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for PRs only | |
|
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for PRs only | |
|
||||||
| [exempt-draft-pr](#exempt-draft-pr) | Skip the stale action for draft PRs | `false` |
|
| [exempt-draft-pr](#exempt-draft-pr) | Skip the stale action for draft PRs | `false` |
|
||||||
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
||||||
| [ignore-updates](#ignore-updates) | Any update (update/comment) can reset the stale idle time on the issues/PRs | `false` |
|
| [ignore-issue-updates](#ignore-issue-updates) | Any update (update/comment) can reset the stale idle time on the issues | |
|
||||||
| [ignore-issue-updates](#ignore-issue-updates) | Override [ignore-updates](#ignore-updates) for issues only | |
|
| [ignore-pr-updates](#ignore-pr-updates) | Any update (update/comment) can reset the stale idle time on the PRs | |
|
||||||
| [ignore-pr-updates](#ignore-pr-updates) | Override [ignore-updates](#ignore-updates) for PRs only | |
|
|
||||||
|
|
||||||
### List of output options
|
### List of output options
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ Default value: `${{ github.token }}`
|
||||||
The idle number of days before marking the issues or the pull requests as stale (by adding a label).
|
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](https://docs.github.com/en/rest/reference/issues) field `updated_at`) is older than the idle number of days.
|
The issues or the pull requests will be marked as stale if the last update (based on [GitHub issue](https://docs.github.com/en/rest/reference/issues) 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.
|
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](https://docs.github.com/en/rest/reference/issues) field `created_at`) only matters, you can disable the [ignore-updates](#ignore-updates) option.
|
However, if you wish to ignore this behaviour so that the creation date (based on [GitHub issue](https://docs.github.com/en/rest/reference/issues) field `created_at`) only matters, you can disable the [ignore-issue-updates](#ignore-issue-updates) and [ignore-pr-updates](#ignore-pr-updates) options.
|
||||||
|
|
||||||
If set to a negative number like `-1`, no issues or pull requests will be marked as stale automatically.
|
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.
|
In that case, you can still add the stale label manually to mark as stale.
|
||||||
|
@ -128,7 +127,8 @@ You can fine tune which issues or pull requests should be marked as stale based
|
||||||
- [exempt-all-milestones](#exempt-all-milestones)
|
- [exempt-all-milestones](#exempt-all-milestones)
|
||||||
- [exempt-assignees](#exempt-assignees)
|
- [exempt-assignees](#exempt-assignees)
|
||||||
- [exempt-all-assignees](#exempt-all-assignees)
|
- [exempt-all-assignees](#exempt-all-assignees)
|
||||||
- [ignore-updates](#ignore-updates)
|
- [ignore-issue-updates](#ignore-issue-updates)
|
||||||
|
- [ignore-pr-updates](#ignore-pr-updates)
|
||||||
|
|
||||||
Default value: `60`
|
Default value: `60`
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ This option is only useful if the debug output secret `ACTIONS_STEP_DEBUG` is se
|
||||||
|
|
||||||
Default value: `true`
|
Default value: `true`
|
||||||
|
|
||||||
#### ignore-updates
|
#### ignore-issue-updates
|
||||||
|
|
||||||
The option [days-before-stale](#days-before-stale) will define the number of days before considering the issues or the pull requests as stale.
|
The option [days-before-stale](#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.
|
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.
|
||||||
|
@ -497,17 +497,13 @@ Instead of comparing the number of days based on the [GitHub issue](https://docs
|
||||||
|
|
||||||
Default value: `false`
|
Default value: `false`
|
||||||
|
|
||||||
#### ignore-issue-updates
|
|
||||||
|
|
||||||
Useful to override [ignore-updates](#ignore-updates) but only to ignore the updates for the issues.
|
|
||||||
|
|
||||||
Default value: unset
|
|
||||||
|
|
||||||
#### ignore-pr-updates
|
#### ignore-pr-updates
|
||||||
|
|
||||||
Useful to override [ignore-updates](#ignore-updates) but only to ignore the updates for the pull requests.
|
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](https://docs.github.com/en/rest/reference/issues) field `updated_at`, it will be based on the [GitHub issue](https://docs.github.com/en/rest/reference/issues) field `created_at`.
|
||||||
|
|
||||||
Default value: unset
|
Default value: `false`
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
|
||||||
enableStatistics: true,
|
enableStatistics: true,
|
||||||
labelsToRemoveWhenUnstale: '',
|
labelsToRemoveWhenUnstale: '',
|
||||||
labelsToAddWhenUnstale: '',
|
labelsToAddWhenUnstale: '',
|
||||||
ignoreUpdates: false,
|
ignoreIssueUpdates: false,
|
||||||
ignoreIssueUpdates: undefined,
|
ignorePrUpdates: false,
|
||||||
ignorePrUpdates: undefined,
|
|
||||||
exemptDraftPr: false
|
exemptDraftPr: false
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,21 +17,6 @@ describe('ignore-updates options', (): void => {
|
||||||
sut.toIssue().staleIn(10).created(20).updated(5);
|
sut.toIssue().staleIn(10).created(20).updated(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore updates option is disabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.staleOnUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore issue updates option is enabled', (): void => {
|
describe('when the ignore issue updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignoreIssueUpdates();
|
sut.ignoreIssueUpdates();
|
||||||
|
@ -64,38 +49,6 @@ describe('ignore-updates options', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore issue updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnoreIssueUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore updates option is enabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.ignoreUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore issue updates option is enabled', (): void => {
|
describe('when the ignore issue updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignoreIssueUpdates();
|
sut.ignoreIssueUpdates();
|
||||||
|
@ -127,23 +80,6 @@ describe('ignore-updates options', (): void => {
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore issue updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnoreIssueUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the issue should be stale within 10 days and was created 20 days ago and updated 15 days ago', (): void => {
|
describe('when the issue should be stale within 10 days and was created 20 days ago and updated 15 days ago', (): void => {
|
||||||
|
@ -151,21 +87,6 @@ describe('ignore-updates options', (): void => {
|
||||||
sut.toIssue().staleIn(10).created(20).updated(15);
|
sut.toIssue().staleIn(10).created(20).updated(15);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore updates option is disabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.staleOnUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore issue updates option is enabled', (): void => {
|
describe('when the ignore issue updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignoreIssueUpdates();
|
sut.ignoreIssueUpdates();
|
||||||
|
@ -198,38 +119,6 @@ describe('ignore-updates options', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore issue updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnoreIssueUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore updates option is enabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.ignoreUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore issue updates option is enabled', (): void => {
|
describe('when the ignore issue updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignoreIssueUpdates();
|
sut.ignoreIssueUpdates();
|
||||||
|
@ -261,23 +150,6 @@ describe('ignore-updates options', (): void => {
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore issue updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnoreIssueUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the issue', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the pull request should be stale within 10 days and was created 20 days ago and updated 5 days ago', (): void => {
|
describe('when the pull request should be stale within 10 days and was created 20 days ago and updated 5 days ago', (): void => {
|
||||||
|
@ -285,21 +157,6 @@ describe('ignore-updates options', (): void => {
|
||||||
sut.toPullRequest().staleIn(10).created(20).updated(5);
|
sut.toPullRequest().staleIn(10).created(20).updated(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore updates option is disabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.staleOnUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignorePullRequestUpdates();
|
sut.ignorePullRequestUpdates();
|
||||||
|
@ -332,38 +189,6 @@ describe('ignore-updates options', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnorePullRequestUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore updates option is enabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.ignoreUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignorePullRequestUpdates();
|
sut.ignorePullRequestUpdates();
|
||||||
|
@ -395,23 +220,6 @@ describe('ignore-updates options', (): void => {
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnorePullRequestUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the pull request should be stale within 10 days and was created 20 days ago and updated 15 days ago', (): void => {
|
describe('when the pull request should be stale within 10 days and was created 20 days ago and updated 15 days ago', (): void => {
|
||||||
|
@ -419,21 +227,6 @@ describe('ignore-updates options', (): void => {
|
||||||
sut.toPullRequest().staleIn(10).created(20).updated(15);
|
sut.toPullRequest().staleIn(10).created(20).updated(15);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore updates option is disabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.staleOnUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignorePullRequestUpdates();
|
sut.ignorePullRequestUpdates();
|
||||||
|
@ -466,38 +259,6 @@ describe('ignore-updates options', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnorePullRequestUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore updates option is enabled', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.ignoreUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
sut.ignorePullRequestUpdates();
|
sut.ignorePullRequestUpdates();
|
||||||
|
@ -529,23 +290,6 @@ describe('ignore-updates options', (): void => {
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the ignore pull request updates option is unset', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
sut.unsetIgnorePullRequestUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should stale the pull request', async () => {
|
|
||||||
expect.assertions(3);
|
|
||||||
|
|
||||||
await sut.test();
|
|
||||||
|
|
||||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
|
||||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
|
||||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -594,22 +338,6 @@ class SUT {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ignoreUpdates(): SUT {
|
|
||||||
this._updateOptions({
|
|
||||||
ignoreUpdates: true
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
staleOnUpdates(): SUT {
|
|
||||||
this._updateOptions({
|
|
||||||
ignoreUpdates: false
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ignoreIssueUpdates(): SUT {
|
ignoreIssueUpdates(): SUT {
|
||||||
this._updateOptions({
|
this._updateOptions({
|
||||||
ignoreIssueUpdates: true
|
ignoreIssueUpdates: true
|
||||||
|
@ -626,14 +354,6 @@ class SUT {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsetIgnoreIssueUpdates(): SUT {
|
|
||||||
this._updateOptions({
|
|
||||||
ignoreIssueUpdates: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ignorePullRequestUpdates(): SUT {
|
ignorePullRequestUpdates(): SUT {
|
||||||
this._updateOptions({
|
this._updateOptions({
|
||||||
ignorePrUpdates: true
|
ignorePrUpdates: true
|
||||||
|
@ -650,14 +370,6 @@ class SUT {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsetIgnorePullRequestUpdates(): SUT {
|
|
||||||
this._updateOptions({
|
|
||||||
ignorePrUpdates: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
async test(): Promise<number> {
|
async test(): Promise<number> {
|
||||||
return this._setTestIssueList()._setProcessor();
|
return this._setTestIssueList()._setProcessor();
|
||||||
}
|
}
|
||||||
|
|
12
action.yml
12
action.yml
|
@ -180,17 +180,13 @@ inputs:
|
||||||
description: '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.'
|
description: '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.'
|
||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
ignore-updates:
|
ignore-issue-updates:
|
||||||
description: 'Any update (update/comment) can reset the stale idle time on the issues and pull requests.'
|
description: 'Any update (update/comment) can reset the stale idle time on the issues.'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
ignore-issue-updates:
|
|
||||||
description: 'Any update (update/comment) can reset the stale idle time on the issues. Override "ignore-updates" option regarding only the issues.'
|
|
||||||
default: ''
|
|
||||||
required: false
|
|
||||||
ignore-pr-updates:
|
ignore-pr-updates:
|
||||||
description: 'Any update (update/comment) can reset the stale idle time on the pull requests. Override "ignore-updates" option regarding only the pull requests.'
|
description: 'Any update (update/comment) can reset the stale idle time on the pull requests.'
|
||||||
default: ''
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
closed-issues-prs:
|
closed-issues-prs:
|
||||||
|
|
|
@ -25,27 +25,6 @@ describe('IgnoreUpdates', (): void => {
|
||||||
issueInterface.pull_request = undefined;
|
issueInterface.pull_request = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
optionsInterface.ignoreUpdates = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are not configured to reset the issue stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
delete optionsInterface.ignoreIssueUpdates;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false', (): void => {
|
|
||||||
expect.assertions(1);
|
|
||||||
issue = new Issue(optionsInterface, issueInterface);
|
|
||||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
|
||||||
|
|
||||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
|
||||||
|
|
||||||
expect(result).toStrictEqual(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
optionsInterface.ignoreIssueUpdates = false;
|
optionsInterface.ignoreIssueUpdates = false;
|
||||||
|
@ -77,28 +56,6 @@ describe('IgnoreUpdates', (): void => {
|
||||||
expect(result).toStrictEqual(true);
|
expect(result).toStrictEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
optionsInterface.ignoreUpdates = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are not configured to reset the issue stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
delete optionsInterface.ignoreIssueUpdates;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return true', (): void => {
|
|
||||||
expect.assertions(1);
|
|
||||||
issue = new Issue(optionsInterface, issueInterface);
|
|
||||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
|
||||||
|
|
||||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
|
||||||
|
|
||||||
expect(result).toStrictEqual(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
|
@ -132,34 +89,12 @@ describe('IgnoreUpdates', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given issue is a pull request', (): void => {
|
describe('when the given issue is a pull request', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
issueInterface.pull_request = {};
|
issueInterface.pull_request = {};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
optionsInterface.ignoreUpdates = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are not configured to reset the pull request stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
delete optionsInterface.ignorePrUpdates;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false', (): void => {
|
|
||||||
expect.assertions(1);
|
|
||||||
issue = new Issue(optionsInterface, issueInterface);
|
|
||||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
|
||||||
|
|
||||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
|
||||||
|
|
||||||
expect(result).toStrictEqual(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
optionsInterface.ignorePrUpdates = false;
|
optionsInterface.ignorePrUpdates = false;
|
||||||
|
@ -191,28 +126,6 @@ describe('IgnoreUpdates', (): void => {
|
||||||
expect(result).toStrictEqual(true);
|
expect(result).toStrictEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to not reset the stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
optionsInterface.ignoreUpdates = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are not configured to reset the pull request stale on updates', (): void => {
|
|
||||||
beforeEach((): void => {
|
|
||||||
delete optionsInterface.ignorePrUpdates;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return true', (): void => {
|
|
||||||
expect.assertions(1);
|
|
||||||
issue = new Issue(optionsInterface, issueInterface);
|
|
||||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
|
||||||
|
|
||||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
|
||||||
|
|
||||||
expect(result).toStrictEqual(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
|
@ -247,5 +160,4 @@ describe('IgnoreUpdates', (): void => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class IgnoreUpdates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _shouldIgnorePullRequestUpdates(): boolean {
|
private _shouldIgnorePullRequestUpdates(): boolean {
|
||||||
if (this._options.ignorePrUpdates === true) {
|
if (this._options.ignorePrUpdates) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.IgnorePrUpdates
|
Option.IgnorePrUpdates
|
||||||
|
@ -33,7 +33,8 @@ export class IgnoreUpdates {
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (this._options.ignorePrUpdates === false) {
|
}
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.IgnorePrUpdates
|
Option.IgnorePrUpdates
|
||||||
|
@ -43,13 +44,8 @@ export class IgnoreUpdates {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._logIgnoreUpdates();
|
|
||||||
|
|
||||||
return this._options.ignoreUpdates;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _shouldIgnoreIssueUpdates(): boolean {
|
private _shouldIgnoreIssueUpdates(): boolean {
|
||||||
if (this._options.ignoreIssueUpdates === true) {
|
if (this._options.ignoreIssueUpdates) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.IgnoreIssueUpdates
|
Option.IgnoreIssueUpdates
|
||||||
|
@ -57,7 +53,8 @@ export class IgnoreUpdates {
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (this._options.ignoreIssueUpdates === false) {
|
}
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.IgnoreIssueUpdates
|
Option.IgnoreIssueUpdates
|
||||||
|
@ -66,25 +63,4 @@ export class IgnoreUpdates {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._logIgnoreUpdates();
|
|
||||||
|
|
||||||
return this._options.ignoreUpdates;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _logIgnoreUpdates(): void {
|
|
||||||
if (this._options.ignoreUpdates) {
|
|
||||||
this._issueLogger.info(
|
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
|
||||||
Option.IgnoreUpdates
|
|
||||||
)} is enabled. The stale counter will ignore any updates or comments on this $$type and will use the creation date as a reference ignoring any kind of update`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this._issueLogger.info(
|
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
|
||||||
Option.IgnoreUpdates
|
|
||||||
)} is disabled. The stale counter will take into account updates and comments on this $$type to avoid to stale when there is some update`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,8 @@ describe('Issue', (): void => {
|
||||||
enableStatistics: false,
|
enableStatistics: false,
|
||||||
labelsToRemoveWhenUnstale: '',
|
labelsToRemoveWhenUnstale: '',
|
||||||
labelsToAddWhenUnstale: '',
|
labelsToAddWhenUnstale: '',
|
||||||
ignoreUpdates: false,
|
ignoreIssueUpdates: false,
|
||||||
ignoreIssueUpdates: undefined,
|
ignorePrUpdates: false,
|
||||||
ignorePrUpdates: undefined,
|
|
||||||
exemptDraftPr: false
|
exemptDraftPr: false
|
||||||
};
|
};
|
||||||
issueInterface = {
|
issueInterface = {
|
||||||
|
|
|
@ -43,7 +43,6 @@ export enum Option {
|
||||||
EnableStatistics = 'enable-statistics',
|
EnableStatistics = 'enable-statistics',
|
||||||
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
|
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
|
||||||
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
|
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
|
||||||
IgnoreUpdates = 'ignore-updates',
|
|
||||||
IgnoreIssueUpdates = 'ignore-issue-updates',
|
IgnoreIssueUpdates = 'ignore-issue-updates',
|
||||||
IgnorePrUpdates = 'ignore-pr-updates',
|
IgnorePrUpdates = 'ignore-pr-updates',
|
||||||
ExemptDraftPr = 'exempt-draft-pr'
|
ExemptDraftPr = 'exempt-draft-pr'
|
||||||
|
|
|
@ -47,8 +47,7 @@ export interface IIssuesProcessorOptions {
|
||||||
enableStatistics: boolean;
|
enableStatistics: boolean;
|
||||||
labelsToRemoveWhenUnstale: string;
|
labelsToRemoveWhenUnstale: string;
|
||||||
labelsToAddWhenUnstale: string;
|
labelsToAddWhenUnstale: string;
|
||||||
ignoreUpdates: boolean;
|
ignoreIssueUpdates: boolean;
|
||||||
ignoreIssueUpdates: boolean | undefined;
|
ignorePrUpdates: boolean;
|
||||||
ignorePrUpdates: boolean | undefined;
|
|
||||||
exemptDraftPr: boolean;
|
exemptDraftPr: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,8 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||||
enableStatistics: core.getInput('enable-statistics') === 'true',
|
enableStatistics: core.getInput('enable-statistics') === 'true',
|
||||||
labelsToRemoveWhenUnstale: core.getInput('labels-to-remove-when-unstale'),
|
labelsToRemoveWhenUnstale: core.getInput('labels-to-remove-when-unstale'),
|
||||||
labelsToAddWhenUnstale: core.getInput('labels-to-add-when-unstale'),
|
labelsToAddWhenUnstale: core.getInput('labels-to-add-when-unstale'),
|
||||||
ignoreUpdates: core.getInput('ignore-updates') === 'true',
|
ignoreIssueUpdates: core.getInput('ignore-issue-updates') === 'true',
|
||||||
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
|
ignorePrUpdates: core.getInput('ignore-pr-updates') === 'true',
|
||||||
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
|
|
||||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true'
|
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue