feat: remove the ignore-updates option
BREAKING CHANGE: The option ignore-updates was removed
This commit is contained in:
parent
b98591d49e
commit
3021a55a47
122
README.md
122
README.md
|
@ -28,58 +28,57 @@ You can find more information about the required permissions under the correspon
|
|||
|
||||
Every argument is optional.
|
||||
|
||||
| Input | Description | Default |
|
||||
| ------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------- |
|
||||
| [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-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | |
|
||||
| [days-before-pr-stale](#days-before-pr-stale) | Override [days-before-stale](#days-before-stale) for PRs only | |
|
||||
| [days-before-close](#days-before-close) | Idle number of days before closing stale issues/PRs | `7` |
|
||||
| [days-before-issue-close](#days-before-issue-close) | Override [days-before-close](#days-before-close) for issues only | |
|
||||
| [days-before-pr-close](#days-before-pr-close) | Override [days-before-close](#days-before-close) for PRs only | |
|
||||
| [stale-issue-message](#stale-issue-message) | Comment on the staled issues | |
|
||||
| [stale-pr-message](#stale-pr-message) | Comment on the staled PRs | |
|
||||
| [close-issue-message](#close-issue-message) | Comment on the staled issues while closed | |
|
||||
| [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | |
|
||||
| [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` |
|
||||
| [close-issue-label](#close-issue-label) | Label to apply on closed issues | |
|
||||
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
|
||||
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
|
||||
| [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
|
||||
| [exempt-pr-labels](#exempt-pr-labels) | Labels on PRs exempted from stale | |
|
||||
| [only-labels](#only-labels) | Only issues/PRs with ALL these labels are checked | |
|
||||
| [only-issue-labels](#only-issue-labels) | Override [only-labels](#only-labels) for issues only | |
|
||||
| [only-pr-labels](#only-pr-labels) | Override [only-labels](#only-labels) for PRs only | |
|
||||
| [any-of-labels](#any-of-labels) | Only issues/PRs with ANY of these labels are checked | |
|
||||
| [any-of-issue-labels](#any-of-issue-labels) | Override [any-of-labels](#any-of-labels) for issues only | |
|
||||
| [any-of-pr-labels](#any-of-pr-labels) | Override [any-of-labels](#any-of-labels) for PRs only | |
|
||||
| [operations-per-run](#operations-per-run) | Max number of operations per run | `30` |
|
||||
| [remove-stale-when-updated](#remove-stale-when-updated) | Remove stale label from issues/PRs on updates | `true` |
|
||||
| [remove-issue-stale-when-updated](#remove-issue-stale-when-updated) | Remove stale label from issues on updates/comments | |
|
||||
| [remove-pr-stale-when-updated](#remove-pr-stale-when-updated) | Remove stale label from PRs on updates/comments | |
|
||||
| [labels-to-add-when-unstale](#labels-to-add-when-unstale) | Add specified labels from issues/PRs when they become unstale | |
|
||||
| [labels-to-remove-when-unstale](#labels-to-remove-when-unstale) | Remove specified labels from issues/PRs when they become unstale | |
|
||||
| [debug-only](#debug-only) | Dry-run | `false` |
|
||||
| [ascending](#ascending) | Order to get issues/PRs | `false` |
|
||||
| [start-date](#start-date) | Skip stale action for issues/PRs created before it | |
|
||||
| [delete-branch](#delete-branch) | Delete branch after closing a stale PR | `false` |
|
||||
| [exempt-milestones](#exempt-milestones) | Milestones on issues/PRs exempted from stale | |
|
||||
| [exempt-issue-milestones](#exempt-issue-milestones) | Override [exempt-milestones](#exempt-milestones) for issues only | |
|
||||
| [exempt-pr-milestones](#exempt-pr-milestones) | Override [exempt-milestones](#exempt-milestones) for PRs only | |
|
||||
| [exempt-all-milestones](#exempt-all-milestones) | Exempt all issues/PRs with milestones from stale | `false` |
|
||||
| [exempt-all-issue-milestones](#exempt-all-issue-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for issues only | |
|
||||
| [exempt-all-pr-milestones](#exempt-all-pr-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for PRs only | |
|
||||
| [exempt-assignees](#exempt-assignees) | Assignees on issues/PRs exempted from stale | |
|
||||
| [exempt-issue-assignees](#exempt-issue-assignees) | Override [exempt-assignees](#exempt-assignees) for issues only | |
|
||||
| [exempt-pr-assignees](#exempt-pr-assignees) | Override [exempt-assignees](#exempt-assignees) for PRs only | |
|
||||
| [exempt-all-assignees](#exempt-all-assignees) | Exempt all issues/PRs with assignees from stale | `false` |
|
||||
| [exempt-all-issue-assignees](#exempt-all-issue-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for issues 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` |
|
||||
| [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) | Override [ignore-updates](#ignore-updates) for issues only | |
|
||||
| [ignore-pr-updates](#ignore-pr-updates) | Override [ignore-updates](#ignore-updates) for PRs only | |
|
||||
| Input | Description | Default |
|
||||
| ------------------------------------------------------------------- | ------------------------------------------------------------------------ | --------------------- |
|
||||
| [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-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | |
|
||||
| [days-before-pr-stale](#days-before-pr-stale) | Override [days-before-stale](#days-before-stale) for PRs only | |
|
||||
| [days-before-close](#days-before-close) | Idle number of days before closing stale issues/PRs | `7` |
|
||||
| [days-before-issue-close](#days-before-issue-close) | Override [days-before-close](#days-before-close) for issues only | |
|
||||
| [days-before-pr-close](#days-before-pr-close) | Override [days-before-close](#days-before-close) for PRs only | |
|
||||
| [stale-issue-message](#stale-issue-message) | Comment on the staled issues | |
|
||||
| [stale-pr-message](#stale-pr-message) | Comment on the staled PRs | |
|
||||
| [close-issue-message](#close-issue-message) | Comment on the staled issues while closed | |
|
||||
| [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | |
|
||||
| [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` |
|
||||
| [close-issue-label](#close-issue-label) | Label to apply on closed issues | |
|
||||
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
|
||||
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
|
||||
| [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
|
||||
| [exempt-pr-labels](#exempt-pr-labels) | Labels on PRs exempted from stale | |
|
||||
| [only-labels](#only-labels) | Only issues/PRs with ALL these labels are checked | |
|
||||
| [only-issue-labels](#only-issue-labels) | Override [only-labels](#only-labels) for issues only | |
|
||||
| [only-pr-labels](#only-pr-labels) | Override [only-labels](#only-labels) for PRs only | |
|
||||
| [any-of-labels](#any-of-labels) | Only issues/PRs with ANY of these labels are checked | |
|
||||
| [any-of-issue-labels](#any-of-issue-labels) | Override [any-of-labels](#any-of-labels) for issues only | |
|
||||
| [any-of-pr-labels](#any-of-pr-labels) | Override [any-of-labels](#any-of-labels) for PRs only | |
|
||||
| [operations-per-run](#operations-per-run) | Max number of operations per run | `30` |
|
||||
| [remove-stale-when-updated](#remove-stale-when-updated) | Remove stale label from issues/PRs on updates | `true` |
|
||||
| [remove-issue-stale-when-updated](#remove-issue-stale-when-updated) | Remove stale label from issues on updates/comments | |
|
||||
| [remove-pr-stale-when-updated](#remove-pr-stale-when-updated) | Remove stale label from PRs on updates/comments | |
|
||||
| [labels-to-add-when-unstale](#labels-to-add-when-unstale) | Add specified labels from issues/PRs when they become unstale | |
|
||||
| [labels-to-remove-when-unstale](#labels-to-remove-when-unstale) | Remove specified labels from issues/PRs when they become unstale | |
|
||||
| [debug-only](#debug-only) | Dry-run | `false` |
|
||||
| [ascending](#ascending) | Order to get issues/PRs | `false` |
|
||||
| [start-date](#start-date) | Skip stale action for issues/PRs created before it | |
|
||||
| [delete-branch](#delete-branch) | Delete branch after closing a stale PR | `false` |
|
||||
| [exempt-milestones](#exempt-milestones) | Milestones on issues/PRs exempted from stale | |
|
||||
| [exempt-issue-milestones](#exempt-issue-milestones) | Override [exempt-milestones](#exempt-milestones) for issues only | |
|
||||
| [exempt-pr-milestones](#exempt-pr-milestones) | Override [exempt-milestones](#exempt-milestones) for PRs only | |
|
||||
| [exempt-all-milestones](#exempt-all-milestones) | Exempt all issues/PRs with milestones from stale | `false` |
|
||||
| [exempt-all-issue-milestones](#exempt-all-issue-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for issues only | |
|
||||
| [exempt-all-pr-milestones](#exempt-all-pr-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for PRs only | |
|
||||
| [exempt-assignees](#exempt-assignees) | Assignees on issues/PRs exempted from stale | |
|
||||
| [exempt-issue-assignees](#exempt-issue-assignees) | Override [exempt-assignees](#exempt-assignees) for issues only | |
|
||||
| [exempt-pr-assignees](#exempt-pr-assignees) | Override [exempt-assignees](#exempt-assignees) for PRs only | |
|
||||
| [exempt-all-assignees](#exempt-all-assignees) | Exempt all issues/PRs with assignees from stale | `false` |
|
||||
| [exempt-all-issue-assignees](#exempt-all-issue-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for issues 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` |
|
||||
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
||||
| [ignore-issue-updates](#ignore-issue-updates) | Any update (update/comment) can reset the stale idle time on the issues | |
|
||||
| [ignore-pr-updates](#ignore-pr-updates) | Any update (update/comment) can reset the stale idle time on the PRs | |
|
||||
|
||||
### 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 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.
|
||||
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.
|
||||
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-assignees](#exempt-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`
|
||||
|
||||
|
@ -488,7 +488,7 @@ This option is only useful if the debug output secret `ACTIONS_STEP_DEBUG` is se
|
|||
|
||||
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.
|
||||
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`
|
||||
|
||||
#### 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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
|
|||
enableStatistics: true,
|
||||
labelsToRemoveWhenUnstale: '',
|
||||
labelsToAddWhenUnstale: '',
|
||||
ignoreUpdates: false,
|
||||
ignoreIssueUpdates: undefined,
|
||||
ignorePrUpdates: undefined,
|
||||
ignoreIssueUpdates: false,
|
||||
ignorePrUpdates: false,
|
||||
exemptDraftPr: false
|
||||
});
|
||||
|
|
|
@ -17,9 +17,25 @@ describe('ignore-updates options', (): void => {
|
|||
sut.toIssue().staleIn(10).created(20).updated(5);
|
||||
});
|
||||
|
||||
describe('when the ignore updates option is disabled', (): void => {
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnUpdates();
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
it('should not stale the issue', async () => {
|
||||
|
@ -31,59 +47,11 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
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 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 => {
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreUpdates();
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
it('should stale the issue', async () => {
|
||||
|
@ -95,53 +63,21 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
it('should not stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
it('should not stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
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 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);
|
||||
});
|
||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -151,9 +87,9 @@ describe('ignore-updates options', (): void => {
|
|||
sut.toIssue().staleIn(10).created(20).updated(15);
|
||||
});
|
||||
|
||||
describe('when the ignore updates option is disabled', (): void => {
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnUpdates();
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
it('should stale the issue', async () => {
|
||||
|
@ -165,59 +101,11 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
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 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 => {
|
||||
describe('when the ignore issue updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreUpdates();
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
it('should stale the issue', async () => {
|
||||
|
@ -229,53 +117,37 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
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 => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreIssueUpdates();
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
it('should stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
it('should stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
await sut.test();
|
||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnIssueUpdates();
|
||||
});
|
||||
|
||||
describe('when the ignore issue updates option is unset', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.unsetIgnoreIssueUpdates();
|
||||
});
|
||||
it('should stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
it('should stale the issue', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
await sut.test();
|
||||
|
||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -285,9 +157,25 @@ describe('ignore-updates options', (): void => {
|
|||
sut.toPullRequest().staleIn(10).created(20).updated(5);
|
||||
});
|
||||
|
||||
describe('when the ignore updates option is disabled', (): void => {
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnUpdates();
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
it('should not stale the pull request', async () => {
|
||||
|
@ -299,59 +187,11 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
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 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 => {
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreUpdates();
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
it('should stale the pull request', async () => {
|
||||
|
@ -363,53 +203,21 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
it('should not stale the pull request', async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
it('should not stale the pull request', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
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 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);
|
||||
});
|
||||
expect(sut.processor.staleIssues).toHaveLength(0);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -419,9 +227,9 @@ describe('ignore-updates options', (): void => {
|
|||
sut.toPullRequest().staleIn(10).created(20).updated(15);
|
||||
});
|
||||
|
||||
describe('when the ignore updates option is disabled', (): void => {
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnUpdates();
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
it('should stale the pull request', async () => {
|
||||
|
@ -433,59 +241,11 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
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 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 => {
|
||||
describe('when the ignore pull request updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignoreUpdates();
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
it('should stale the pull request', async () => {
|
||||
|
@ -497,53 +257,37 @@ describe('ignore-updates options', (): void => {
|
|||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
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 => {
|
||||
beforeEach((): void => {
|
||||
sut.ignorePullRequestUpdates();
|
||||
});
|
||||
|
||||
describe('when the ignore pull request updates option is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
it('should stale the pull request', async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
it('should stale the pull request', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
await sut.test();
|
||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
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 disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
sut.staleOnPullRequestUpdates();
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
it('should stale the pull request', async () => {
|
||||
expect.assertions(3);
|
||||
await sut.test();
|
||||
|
||||
await sut.test();
|
||||
|
||||
expect(sut.processor.staleIssues).toHaveLength(1);
|
||||
expect(sut.processor.closedIssues).toHaveLength(0);
|
||||
expect(sut.processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
ignoreUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignoreUpdates: true
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
staleOnUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignoreUpdates: false
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
ignoreIssueUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignoreIssueUpdates: true
|
||||
|
@ -626,14 +354,6 @@ class SUT {
|
|||
return this;
|
||||
}
|
||||
|
||||
unsetIgnoreIssueUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignoreIssueUpdates: undefined
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
ignorePullRequestUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignorePrUpdates: true
|
||||
|
@ -650,14 +370,6 @@ class SUT {
|
|||
return this;
|
||||
}
|
||||
|
||||
unsetIgnorePullRequestUpdates(): SUT {
|
||||
this._updateOptions({
|
||||
ignorePrUpdates: undefined
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async test(): Promise<number> {
|
||||
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.'
|
||||
default: ''
|
||||
required: false
|
||||
ignore-updates:
|
||||
description: 'Any update (update/comment) can reset the stale idle time on the issues and pull requests.'
|
||||
ignore-issue-updates:
|
||||
description: 'Any update (update/comment) can reset the stale idle time on the issues.'
|
||||
default: '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:
|
||||
description: 'Any update (update/comment) can reset the stale idle time on the pull requests. Override "ignore-updates" option regarding only the pull requests.'
|
||||
default: ''
|
||||
description: 'Any update (update/comment) can reset the stale idle time on the pull requests.'
|
||||
default: 'false'
|
||||
required: false
|
||||
outputs:
|
||||
closed-issues-prs:
|
||||
|
|
|
@ -25,111 +25,67 @@ describe('IgnoreUpdates', (): void => {
|
|||
issueInterface.pull_request = undefined;
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreUpdates = false;
|
||||
optionsInterface.ignoreIssueUpdates = 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);
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = false;
|
||||
});
|
||||
|
||||
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 not reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = true;
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
||||
describe('when the given options are configured to not reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreUpdates = true;
|
||||
optionsInterface.ignoreIssueUpdates = 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);
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = false;
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = false;
|
||||
});
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
describe('when the given options are configured to not reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = true;
|
||||
});
|
||||
|
||||
describe('when the given options are configured to not reset the issue stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreIssueUpdates = true;
|
||||
});
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -139,111 +95,67 @@ describe('IgnoreUpdates', (): void => {
|
|||
issueInterface.pull_request = {};
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the stale on updates', (): void => {
|
||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreUpdates = false;
|
||||
optionsInterface.ignorePrUpdates = 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);
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = false;
|
||||
});
|
||||
|
||||
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 not reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = true;
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to not reset the stale on updates', (): void => {
|
||||
describe('when the given options are configured to not reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignoreUpdates = true;
|
||||
optionsInterface.ignorePrUpdates = 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);
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = false;
|
||||
});
|
||||
|
||||
describe('when the given options are configured to reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = false;
|
||||
});
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
describe('when the given options are configured to not reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = true;
|
||||
});
|
||||
|
||||
describe('when the given options are configured to not reset the pull request stale on updates', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.ignorePrUpdates = true;
|
||||
});
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
ignoreUpdates = new IgnoreUpdates(optionsInterface, issue);
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
const result = ignoreUpdates.shouldIgnoreUpdates();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ export class IgnoreUpdates {
|
|||
}
|
||||
|
||||
private _shouldIgnorePullRequestUpdates(): boolean {
|
||||
if (this._options.ignorePrUpdates === true) {
|
||||
if (this._options.ignorePrUpdates) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnorePrUpdates
|
||||
|
@ -33,23 +33,19 @@ export class IgnoreUpdates {
|
|||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.ignorePrUpdates === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnorePrUpdates
|
||||
)} is disabled. The stale counter will take into account updates and comments on this $$type to avoid to stale when there is some update`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logIgnoreUpdates();
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnorePrUpdates
|
||||
)} is disabled. The stale counter will take into account updates and comments on this $$type to avoid to stale when there is some update`
|
||||
);
|
||||
|
||||
return this._options.ignoreUpdates;
|
||||
return false;
|
||||
}
|
||||
|
||||
private _shouldIgnoreIssueUpdates(): boolean {
|
||||
if (this._options.ignoreIssueUpdates === true) {
|
||||
if (this._options.ignoreIssueUpdates) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnoreIssueUpdates
|
||||
|
@ -57,34 +53,14 @@ export class IgnoreUpdates {
|
|||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.ignoreIssueUpdates === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnoreIssueUpdates
|
||||
)} is disabled. The stale counter will take into account updates and comments on this $$type to avoid to stale when there is some update`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logIgnoreUpdates();
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.IgnoreIssueUpdates
|
||||
)} is disabled. The stale counter will take into account updates and comments on this $$type to avoid to stale when there is some update`
|
||||
);
|
||||
|
||||
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`
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,8 @@ describe('Issue', (): void => {
|
|||
enableStatistics: false,
|
||||
labelsToRemoveWhenUnstale: '',
|
||||
labelsToAddWhenUnstale: '',
|
||||
ignoreUpdates: false,
|
||||
ignoreIssueUpdates: undefined,
|
||||
ignorePrUpdates: undefined,
|
||||
ignoreIssueUpdates: false,
|
||||
ignorePrUpdates: false,
|
||||
exemptDraftPr: false
|
||||
};
|
||||
issueInterface = {
|
||||
|
|
|
@ -43,7 +43,6 @@ export enum Option {
|
|||
EnableStatistics = 'enable-statistics',
|
||||
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
|
||||
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
|
||||
IgnoreUpdates = 'ignore-updates',
|
||||
IgnoreIssueUpdates = 'ignore-issue-updates',
|
||||
IgnorePrUpdates = 'ignore-pr-updates',
|
||||
ExemptDraftPr = 'exempt-draft-pr'
|
||||
|
|
|
@ -47,8 +47,7 @@ export interface IIssuesProcessorOptions {
|
|||
enableStatistics: boolean;
|
||||
labelsToRemoveWhenUnstale: string;
|
||||
labelsToAddWhenUnstale: string;
|
||||
ignoreUpdates: boolean;
|
||||
ignoreIssueUpdates: boolean | undefined;
|
||||
ignorePrUpdates: boolean | undefined;
|
||||
ignoreIssueUpdates: boolean;
|
||||
ignorePrUpdates: boolean;
|
||||
exemptDraftPr: boolean;
|
||||
}
|
||||
|
|
|
@ -84,9 +84,8 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
|||
enableStatistics: core.getInput('enable-statistics') === 'true',
|
||||
labelsToRemoveWhenUnstale: core.getInput('labels-to-remove-when-unstale'),
|
||||
labelsToAddWhenUnstale: core.getInput('labels-to-add-when-unstale'),
|
||||
ignoreUpdates: core.getInput('ignore-updates') === 'true',
|
||||
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
|
||||
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
|
||||
ignoreIssueUpdates: core.getInput('ignore-issue-updates') === 'true',
|
||||
ignorePrUpdates: core.getInput('ignore-pr-updates') === 'true',
|
||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true'
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue