mirror of
https://github.com/actions/stale.git
synced 2025-12-24 01:18:17 +00:00
Compare commits
1 Commits
johnsudol/
...
demo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bb2a723cb |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,26 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
# [6.0.1]
|
||||
|
||||
Update @actions/core to v1.10.0 ([#839](https://github.com/actions/stale/pull/839))
|
||||
|
||||
# [6.0.0]
|
||||
|
||||
:warning: Breaking change :warning:
|
||||
|
||||
Issues/PRs default `close-issue-reason` is now `not_planned`([#789](https://github.com/actions/stale/issues/789))
|
||||
|
||||
# [5.1.0]
|
||||
|
||||
[Don't process stale issues right after they're marked stale](https://github.com/actions/stale/issues/696)
|
||||
[Add close-issue-reason option][#764](https://github.com/actions/stale/pull/764)[#772](https://github.com/actions/stale/pull/772)
|
||||
Various dependabot/dependency updates
|
||||
|
||||
|
||||
## [4.1.0](https://github.com/actions/stale/compare/v3.0.19...v4.1.0) (2021-07-14)
|
||||
|
||||
## Features
|
||||
|
||||
- [Ability to exempt draft PRs](https://github.com/actions/stale/commit/9912fa74d1c01b5d6187793d97441019cbe325d0)
|
||||
- [Ability to exempt draft PRs](https://github.com/actions/stale/commit/9912fa74d1c01b5d6187793d97441019cbe325d0
|
||||
)
|
||||
|
||||
## [4.0.0](https://github.com/actions/stale/compare/v3.0.19...v4.0.0) (2021-07-14)
|
||||
|
||||
|
||||
41
README.md
41
README.md
@@ -11,12 +11,11 @@ The configuration must be on the default branch and the default values will:
|
||||
## Recommended permissions
|
||||
|
||||
For the execution of this action, it must be able to fetch all issues and pull requests from your repository.
|
||||
In addition, based on the provided configuration, the action could require more permission(s) (e.g.: add label, remove label, comment, close, delete branch, etc.).
|
||||
In addition, based on the provided configuration, the action could require more permission(s) (e.g.: add label, remove label, comment, close, etc.).
|
||||
This can be achieved with the following [configuration in the action](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions) if the permissions are restricted:
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
contents: write # only for delete-branch option
|
||||
issues: write
|
||||
pull-requests: write
|
||||
```
|
||||
@@ -44,7 +43,7 @@ Every argument is optional.
|
||||
| [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 | |
|
||||
| [close-issue-reason](#close-issue-reason) | Reason to use when closing issues | `not_planned` |
|
||||
| [close-issue-reason](#close-issue-reason) | Reason to use when closing 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 | |
|
||||
@@ -82,7 +81,6 @@ Every argument is optional.
|
||||
| [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 | |
|
||||
| [include-only-assigned](#include-only-assigned) | Process only assigned issues | `false` |
|
||||
|
||||
### List of output options
|
||||
|
||||
@@ -226,7 +224,7 @@ Required Permission: `issues: write`
|
||||
|
||||
Specify the [reason](https://github.blog/changelog/2022-05-19-the-new-github-issues-may-19th-update/) used when closing issues. Valid values are `completed` and `not_planned`.
|
||||
|
||||
Default value: `not_planned`
|
||||
Default value: unset
|
||||
|
||||
#### stale-pr-label
|
||||
|
||||
@@ -246,7 +244,8 @@ Required Permission: `pull-requests: write`
|
||||
|
||||
#### exempt-issue-labels
|
||||
|
||||
A comma separated list of labels, that prevent the issue from being marked as stale. (e.g: `question,bug,wip`)
|
||||
The label(s) that can exempt to automatically mark as stale the issues.
|
||||
It can be a comma separated list of labels (e.g: `question,bug`).
|
||||
|
||||
If unset (or an empty string), this option will not alter the stale workflow.
|
||||
|
||||
@@ -397,7 +396,7 @@ Default value: unset
|
||||
If set to `true`, the stale workflow will automatically delete the GitHub branches related to the pull requests automatically closed by the stale workflow.
|
||||
|
||||
Default value: `false`
|
||||
Required Permission: `pull-requests: write` and `contents: write`
|
||||
Required Permission: `pull-requests: write`
|
||||
|
||||
#### exempt-milestones
|
||||
|
||||
@@ -517,12 +516,6 @@ Useful to override [ignore-updates](#ignore-updates) but only to ignore the upda
|
||||
|
||||
Default value: unset
|
||||
|
||||
#### include-only-assigned
|
||||
|
||||
If set to `true`, only the issues or the pull requests with an assignee will be marked as stale automatically.
|
||||
|
||||
Default value: `false`
|
||||
|
||||
### Usage
|
||||
|
||||
See also [action.yml](./action.yml) for a comprehensive list of all the options.
|
||||
@@ -539,7 +532,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
|
||||
stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'
|
||||
@@ -557,7 +550,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
days-before-stale: 30
|
||||
@@ -576,7 +569,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
@@ -598,7 +591,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
@@ -622,7 +615,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: 'Stale issue message'
|
||||
stale-pr-message: 'Stale pull request message'
|
||||
@@ -645,7 +638,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
start-date: '2020-04-18T00:00:00Z' # ISO 8601 or RFC 2822
|
||||
```
|
||||
@@ -662,7 +655,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
exempt-issue-milestones: 'future,alpha,beta'
|
||||
exempt-pr-milestones: 'bugfix,improvement'
|
||||
@@ -680,7 +673,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
exempt-all-pr-milestones: true
|
||||
```
|
||||
@@ -697,7 +690,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
any-of-labels: 'needs-more-info,needs-demo'
|
||||
# You can opt for 'only-labels' instead if your use-case requires all labels
|
||||
@@ -716,7 +709,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
exempt-issue-assignees: 'marco,polo'
|
||||
exempt-pr-assignees: 'marco'
|
||||
@@ -734,7 +727,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
exempt-all-pr-assignees: true
|
||||
```
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
|
||||
|
||||
// Default options for use in tests.
|
||||
// Mirrors the defaults defined in action.yml
|
||||
export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
|
||||
repoToken: 'none',
|
||||
staleIssueMessage: 'This issue is stale',
|
||||
@@ -53,6 +51,5 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
|
||||
ignoreIssueUpdates: undefined,
|
||||
ignorePrUpdates: undefined,
|
||||
exemptDraftPr: false,
|
||||
closeIssueReason: 'not_planned',
|
||||
includeOnlyAssigned: false
|
||||
closeIssueReason: ''
|
||||
});
|
||||
|
||||
@@ -1998,84 +1998,6 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing an issue opened since 1 hour and with the option "daysBeforeIssueStale" at 0.1666666667 (4 hours) will not make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforeIssueStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 1);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(opts, 1, 'An issue with no label', issueDate.toISOString())
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(0);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing an issue opened since 4 hours and with the option "daysBeforeIssueStale" at 0.1666666667 (4 hours) will make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforeIssueStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 4);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(opts, 1, 'An issue with no label', issueDate.toISOString())
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(1);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing an issue opened since 5 hours and with the option "daysBeforeIssueStale" at 0.1666666667 (4 hours) will make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforeIssueStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 5);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(opts, 1, 'An issue with no label', issueDate.toISOString())
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(1);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing a pull request opened since 2 days and with the option "daysBeforePrStale" at 3 will not make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
@@ -2175,105 +2097,6 @@ test('processing a pull request opened since 2 days and with the option "daysBef
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing a pull request opened since 1 hour and with the option "daysBeforePrStale" at 0.1666666667 (4 hours) will not make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforePrStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 1);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(
|
||||
opts,
|
||||
1,
|
||||
'A pull request with no label',
|
||||
issueDate.toISOString(),
|
||||
issueDate.toISOString(),
|
||||
true
|
||||
)
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(0);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing a pull request opened since 4 hours and with the option "daysBeforePrStale" at 0.1666666667 (4 hours) will make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforePrStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 4);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(
|
||||
opts,
|
||||
1,
|
||||
'A pull request with no label',
|
||||
issueDate.toISOString(),
|
||||
issueDate.toISOString(),
|
||||
true
|
||||
)
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(1);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing a pull request opened since 5 hours and with the option "daysBeforePrStale" at 0.1666666667 (4 hours) will make it stale', async () => {
|
||||
expect.assertions(2);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
daysBeforeStale: 10,
|
||||
daysBeforePrStale: 0.1666666667
|
||||
};
|
||||
const issueDate = new Date();
|
||||
issueDate.setHours(issueDate.getHours() - 5);
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(
|
||||
opts,
|
||||
1,
|
||||
'A pull request with no label',
|
||||
issueDate.toISOString(),
|
||||
issueDate.toISOString(),
|
||||
true
|
||||
)
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toISOString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(1);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing a previously closed issue with a close label will remove the close label', async () => {
|
||||
expect.assertions(1);
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
@@ -2529,69 +2352,3 @@ test('processing a pull request to be stale with the "stalePrMessage" option set
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
expect(processor.statistics?.addedPullRequestsCommentsCount).toStrictEqual(0);
|
||||
});
|
||||
|
||||
test('processing an issue with the "includeOnlyAssigned" option and nonempty assignee list will stale the issue', async () => {
|
||||
const issueDate = new Date();
|
||||
issueDate.setDate(issueDate.getDate() - 2);
|
||||
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
staleIssueLabel: 'This issue is stale',
|
||||
includeOnlyAssigned: true
|
||||
};
|
||||
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(
|
||||
opts,
|
||||
1,
|
||||
'An issue with no label',
|
||||
issueDate.toDateString(),
|
||||
issueDate.toDateString(),
|
||||
false,
|
||||
[],
|
||||
false,
|
||||
false,
|
||||
undefined,
|
||||
['assignee1']
|
||||
)
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toDateString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(1);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('processing an issue with the "includeOnlyAssigned" option set and no assignees will not stale the issue', async () => {
|
||||
const issueDate = new Date();
|
||||
issueDate.setDate(issueDate.getDate() - 2);
|
||||
|
||||
const opts: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions,
|
||||
staleIssueLabel: 'This issue is stale',
|
||||
includeOnlyAssigned: true
|
||||
};
|
||||
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(opts, 1, 'An issue with no label', issueDate.toDateString())
|
||||
];
|
||||
const processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async p => (p === 1 ? TestIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toDateString()
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(0);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ inputs:
|
||||
required: false
|
||||
close-issue-reason:
|
||||
description: 'The reason to use when closing an issue.'
|
||||
default: 'not_planned'
|
||||
default: ''
|
||||
required: false
|
||||
stale-pr-label:
|
||||
description: 'The label to apply when a pull request is stale.'
|
||||
@@ -196,10 +196,6 @@ inputs:
|
||||
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: ''
|
||||
required: false
|
||||
include-only-assigned:
|
||||
description: 'Only the issues or the pull requests with an assignee will be marked as stale automatically.'
|
||||
default: 'false'
|
||||
required: false
|
||||
outputs:
|
||||
closed-issues-prs:
|
||||
description: 'List of all closed issues and pull requests.'
|
||||
|
||||
117
dist/index.js
vendored
117
dist/index.js
vendored
@@ -381,7 +381,7 @@ class IssuesProcessor {
|
||||
this.options = options;
|
||||
this.client = github_1.getOctokit(this.options.repoToken);
|
||||
this.operations = new stale_operations_1.StaleOperations(this.options);
|
||||
this._logger.info(logger_service_1.LoggerService.yellow(`Starting the stale action process... logging`));
|
||||
this._logger.info(logger_service_1.LoggerService.yellow(`Starting the stale action process...`));
|
||||
if (this.options.debugOnly) {
|
||||
this._logger.warning(logger_service_1.LoggerService.yellowBright(`Executing in debug mode!`));
|
||||
this._logger.warning(logger_service_1.LoggerService.yellowBright(`The debug output will be written but no issues/PRs will be processed.`));
|
||||
@@ -476,11 +476,6 @@ class IssuesProcessor {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
return; // Don't process locked issues
|
||||
}
|
||||
if (this._isIncludeOnlyAssigned(issue)) {
|
||||
issueLogger.info(`Skipping this $$type because its assignees list is empty`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list
|
||||
}
|
||||
const onlyLabels = words_to_list_1.wordsToList(this._getOnlyLabels(issue));
|
||||
if (onlyLabels.length > 0) {
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`);
|
||||
@@ -526,15 +521,14 @@ class IssuesProcessor {
|
||||
issueLogger.info(`This $$type has a stale label`);
|
||||
}
|
||||
else {
|
||||
issueLogger.info(`This $$type doesn't have a stale label`);
|
||||
issueLogger.info(`This $$type hasn't a stale label`);
|
||||
}
|
||||
const exemptLabels = words_to_list_1.wordsToList(issue.isPullRequest
|
||||
? this.options.exemptPrLabels
|
||||
: this.options.exemptIssueLabels);
|
||||
if (exemptLabels.some((exemptLabel) => is_labeled_1.isLabeled(issue, exemptLabel))) {
|
||||
if (issue.isStale) {
|
||||
// issueLogger.info(`An exempt label was added after the stale label.`);
|
||||
issueLogger.info(`This $$type has an exempt label, removing the stale label.`);
|
||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
||||
yield this._removeStaleLabel(issue, staleLabel);
|
||||
}
|
||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
||||
@@ -583,7 +577,7 @@ class IssuesProcessor {
|
||||
}
|
||||
// Determine if this issue needs to be marked stale first
|
||||
if (!issue.isStale) {
|
||||
issueLogger.info(`This $$type is not stale`);
|
||||
issueLogger.info(`This $$type is not stale. Demo message.`);
|
||||
const shouldIgnoreUpdates = new ignore_updates_1.IgnoreUpdates(this.options, issue).shouldIgnoreUpdates();
|
||||
// Should this issue be marked as stale?
|
||||
let shouldBeStale;
|
||||
@@ -743,9 +737,7 @@ class IssuesProcessor {
|
||||
if (issue.markedStaleThisRun) {
|
||||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
}
|
||||
// The issue.updated_at and markedStaleOn are not always exactly in sync (they can be off by a second or 2)
|
||||
// isDateMoreRecentThan makes sure they are not the same date within a certain tolerance (15 seconds in this case)
|
||||
const issueHasUpdateSinceStale = is_date_more_recent_than_1.isDateMoreRecentThan(new Date(issue.updated_at), new Date(markedStaleOn), 15);
|
||||
const issueHasUpdateSinceStale = new Date(issue.updated_at) > new Date(markedStaleOn);
|
||||
issueLogger.info(`$$type has been updated since it was marked stale: ${logger_service_1.LoggerService.cyan(issueHasUpdateSinceStale)}`);
|
||||
// Should we un-stale this issue?
|
||||
if (shouldRemoveStaleWhenUpdated &&
|
||||
@@ -996,9 +988,6 @@ class IssuesProcessor {
|
||||
}
|
||||
return this.options.onlyLabels;
|
||||
}
|
||||
_isIncludeOnlyAssigned(issue) {
|
||||
return this.options.includeOnlyAssigned && !issue.hasAssignees;
|
||||
}
|
||||
_getAnyOfLabels(issue) {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.anyOfPrLabels !== '') {
|
||||
@@ -1968,25 +1957,12 @@ exports.getHumanizedDate = getHumanizedDate;
|
||||
|
||||
"use strict";
|
||||
|
||||
/// returns false if the dates are equal within the `equalityToleranceInSeconds` number of seconds
|
||||
/// otherwise returns true if `comparedDate` is after `date`
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.isDateEqualTo = exports.isDateMoreRecentThan = void 0;
|
||||
function isDateMoreRecentThan(date, comparedDate, equalityToleranceInSeconds = 0) {
|
||||
if (equalityToleranceInSeconds > 0) {
|
||||
const areDatesEqual = isDateEqualTo(date, comparedDate, equalityToleranceInSeconds);
|
||||
return !areDatesEqual && date > comparedDate;
|
||||
}
|
||||
exports.isDateMoreRecentThan = void 0;
|
||||
function isDateMoreRecentThan(date, comparedDate) {
|
||||
return date > comparedDate;
|
||||
}
|
||||
exports.isDateMoreRecentThan = isDateMoreRecentThan;
|
||||
function isDateEqualTo(date, otherDate, toleranceInSeconds) {
|
||||
const timestamp = date.getTime();
|
||||
const otherTimestamp = otherDate.getTime();
|
||||
const deltaInSeconds = Math.abs(timestamp - otherTimestamp) / 1000;
|
||||
return deltaInSeconds <= toleranceInSeconds;
|
||||
}
|
||||
exports.isDateEqualTo = isDateEqualTo;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -2184,9 +2160,9 @@ function _getAndValidateArgs() {
|
||||
stalePrMessage: core.getInput('stale-pr-message'),
|
||||
closeIssueMessage: core.getInput('close-issue-message'),
|
||||
closePrMessage: core.getInput('close-pr-message'),
|
||||
daysBeforeStale: parseFloat(core.getInput('days-before-stale', { required: true })),
|
||||
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
||||
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
||||
daysBeforeStale: parseInt(core.getInput('days-before-stale', { required: true })),
|
||||
daysBeforeIssueStale: parseInt(core.getInput('days-before-issue-stale')),
|
||||
daysBeforePrStale: parseInt(core.getInput('days-before-pr-stale')),
|
||||
daysBeforeClose: parseInt(core.getInput('days-before-close', { required: true })),
|
||||
daysBeforeIssueClose: parseInt(core.getInput('days-before-issue-close')),
|
||||
daysBeforePrClose: parseInt(core.getInput('days-before-pr-close')),
|
||||
@@ -2231,17 +2207,13 @@ function _getAndValidateArgs() {
|
||||
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
|
||||
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
|
||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true',
|
||||
closeIssueReason: core.getInput('close-issue-reason'),
|
||||
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
||||
closeIssueReason: core.getInput('close-issue-reason')
|
||||
};
|
||||
for (const numberInput of ['days-before-stale']) {
|
||||
if (isNaN(parseFloat(core.getInput(numberInput)))) {
|
||||
const errorMessage = `Option "${numberInput}" did not parse to a valid float`;
|
||||
core.setFailed(errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
for (const numberInput of ['days-before-close', 'operations-per-run']) {
|
||||
for (const numberInput of [
|
||||
'days-before-stale',
|
||||
'days-before-close',
|
||||
'operations-per-run'
|
||||
]) {
|
||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
||||
core.setFailed(errorMessage);
|
||||
@@ -2488,6 +2460,7 @@ const file_command_1 = __nccwpck_require__(717);
|
||||
const utils_1 = __nccwpck_require__(5278);
|
||||
const os = __importStar(__nccwpck_require__(2087));
|
||||
const path = __importStar(__nccwpck_require__(5622));
|
||||
const uuid_1 = __nccwpck_require__(5840);
|
||||
const oidc_utils_1 = __nccwpck_require__(8041);
|
||||
/**
|
||||
* The code to exit an action
|
||||
@@ -2517,9 +2490,20 @@ function exportVariable(name, val) {
|
||||
process.env[name] = convertedVal;
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
|
||||
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
||||
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
||||
if (name.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
||||
}
|
||||
if (convertedVal.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
||||
}
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@@ -2537,7 +2521,7 @@ exports.setSecret = setSecret;
|
||||
function addPath(inputPath) {
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueFileCommand('PATH', inputPath);
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
@@ -2577,10 +2561,7 @@ function getMultilineInput(name, options) {
|
||||
const inputs = getInput(name, options)
|
||||
.split('\n')
|
||||
.filter(x => x !== '');
|
||||
if (options && options.trimWhitespace === false) {
|
||||
return inputs;
|
||||
}
|
||||
return inputs.map(input => input.trim());
|
||||
return inputs;
|
||||
}
|
||||
exports.getMultilineInput = getMultilineInput;
|
||||
/**
|
||||
@@ -2613,12 +2594,8 @@ exports.getBooleanInput = getBooleanInput;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
const filePath = process.env['GITHUB_OUTPUT'] || '';
|
||||
if (filePath) {
|
||||
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
|
||||
}
|
||||
process.stdout.write(os.EOL);
|
||||
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
/**
|
||||
@@ -2747,11 +2724,7 @@ exports.group = group;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
const filePath = process.env['GITHUB_STATE'] || '';
|
||||
if (filePath) {
|
||||
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
|
||||
}
|
||||
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
exports.saveState = saveState;
|
||||
/**
|
||||
@@ -2817,14 +2790,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
|
||||
exports.issueCommand = void 0;
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__nccwpck_require__(5747));
|
||||
const os = __importStar(__nccwpck_require__(2087));
|
||||
const uuid_1 = __nccwpck_require__(5840);
|
||||
const utils_1 = __nccwpck_require__(5278);
|
||||
function issueFileCommand(command, message) {
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
@@ -2836,22 +2808,7 @@ function issueFileCommand(command, message) {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueFileCommand = issueFileCommand;
|
||||
function prepareKeyValueMessage(key, value) {
|
||||
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
||||
const convertedValue = utils_1.toCommandValue(value);
|
||||
// These should realistically never happen, but just in case someone finds a
|
||||
// way to exploit uuid generation let's not allow keys or values that contain
|
||||
// the delimiter.
|
||||
if (key.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
||||
}
|
||||
if (convertedValue.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
||||
}
|
||||
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
|
||||
}
|
||||
exports.prepareKeyValueMessage = prepareKeyValueMessage;
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
11707
package-lock.json
generated
11707
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^5.0.1",
|
||||
"lodash.deburr": "^4.1.0",
|
||||
"semver": "^7.3.5"
|
||||
|
||||
@@ -62,8 +62,7 @@ describe('Issue', (): void => {
|
||||
ignoreIssueUpdates: undefined,
|
||||
ignorePrUpdates: undefined,
|
||||
exemptDraftPr: false,
|
||||
closeIssueReason: '',
|
||||
includeOnlyAssigned: false
|
||||
closeIssueReason: ''
|
||||
};
|
||||
issueInterface = {
|
||||
title: 'dummy-title',
|
||||
|
||||
@@ -78,7 +78,7 @@ export class IssuesProcessor {
|
||||
this.operations = new StaleOperations(this.options);
|
||||
|
||||
this._logger.info(
|
||||
LoggerService.yellow(`Starting the stale action process... logging`)
|
||||
LoggerService.yellow(`Starting the stale action process...`)
|
||||
);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
@@ -221,14 +221,6 @@ export class IssuesProcessor {
|
||||
return; // Don't process locked issues
|
||||
}
|
||||
|
||||
if (this._isIncludeOnlyAssigned(issue)) {
|
||||
issueLogger.info(
|
||||
`Skipping this $$type because its assignees list is empty`
|
||||
);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list
|
||||
}
|
||||
|
||||
const onlyLabels: string[] = wordsToList(this._getOnlyLabels(issue));
|
||||
|
||||
if (onlyLabels.length > 0) {
|
||||
@@ -323,7 +315,7 @@ export class IssuesProcessor {
|
||||
if (issue.isStale) {
|
||||
issueLogger.info(`This $$type has a stale label`);
|
||||
} else {
|
||||
issueLogger.info(`This $$type doesn't have a stale label`);
|
||||
issueLogger.info(`This $$type hasn't a stale label`);
|
||||
}
|
||||
|
||||
const exemptLabels: string[] = wordsToList(
|
||||
@@ -338,10 +330,7 @@ export class IssuesProcessor {
|
||||
)
|
||||
) {
|
||||
if (issue.isStale) {
|
||||
// issueLogger.info(`An exempt label was added after the stale label.`);
|
||||
issueLogger.info(
|
||||
`This $$type has an exempt label, removing the stale label.`
|
||||
);
|
||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
||||
await this._removeStaleLabel(issue, staleLabel);
|
||||
}
|
||||
|
||||
@@ -429,7 +418,7 @@ export class IssuesProcessor {
|
||||
|
||||
// Determine if this issue needs to be marked stale first
|
||||
if (!issue.isStale) {
|
||||
issueLogger.info(`This $$type is not stale`);
|
||||
issueLogger.info(`This $$type is not stale. Demo message.`);
|
||||
const shouldIgnoreUpdates: boolean = new IgnoreUpdates(
|
||||
this.options,
|
||||
issue
|
||||
@@ -676,13 +665,8 @@ export class IssuesProcessor {
|
||||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
}
|
||||
|
||||
// The issue.updated_at and markedStaleOn are not always exactly in sync (they can be off by a second or 2)
|
||||
// isDateMoreRecentThan makes sure they are not the same date within a certain tolerance (15 seconds in this case)
|
||||
const issueHasUpdateSinceStale = isDateMoreRecentThan(
|
||||
new Date(issue.updated_at),
|
||||
new Date(markedStaleOn),
|
||||
15
|
||||
);
|
||||
const issueHasUpdateSinceStale =
|
||||
new Date(issue.updated_at) > new Date(markedStaleOn);
|
||||
|
||||
issueLogger.info(
|
||||
`$$type has been updated since it was marked stale: ${LoggerService.cyan(
|
||||
@@ -1028,10 +1012,6 @@ export class IssuesProcessor {
|
||||
return this.options.onlyLabels;
|
||||
}
|
||||
|
||||
private _isIncludeOnlyAssigned(issue: Issue): boolean {
|
||||
return this.options.includeOnlyAssigned && !issue.hasAssignees;
|
||||
}
|
||||
|
||||
private _getAnyOfLabels(issue: Issue): string {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.anyOfPrLabels !== '') {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {isDateEqualTo, isDateMoreRecentThan} from './is-date-more-recent-than';
|
||||
import {isDateMoreRecentThan} from './is-date-more-recent-than';
|
||||
|
||||
describe('isDateMoreRecentThan()', (): void => {
|
||||
let date: Date;
|
||||
@@ -48,68 +48,4 @@ describe('isDateMoreRecentThan()', (): void => {
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('date equality', (): void => {
|
||||
it('should correctly compare a before date outside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T14:00:00');
|
||||
expect(isDateEqualTo(aDate, otherDate, 60)).toBe(false);
|
||||
});
|
||||
|
||||
it('should correctly compare a before date inside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T13:00:42');
|
||||
expect(isDateEqualTo(aDate, otherDate, 60)).toBe(true);
|
||||
});
|
||||
|
||||
it('should correctly compare an after date outside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T12:00:00');
|
||||
expect(isDateEqualTo(aDate, otherDate, 60)).toBe(false);
|
||||
});
|
||||
|
||||
it('should correctly compare an after date inside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T12:59:42');
|
||||
expect(isDateEqualTo(aDate, otherDate, 60)).toBe(true);
|
||||
});
|
||||
|
||||
it('should correctly compare an exactly equal date', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T13:00:00');
|
||||
expect(isDateEqualTo(aDate, otherDate, 60)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('date comparison with tolerances', (): void => {
|
||||
it('should correctly compare a before date outside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T14:00:00');
|
||||
expect(isDateMoreRecentThan(aDate, otherDate)).toBe(false);
|
||||
});
|
||||
|
||||
it('should correctly compare a before date inside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T13:00:42');
|
||||
expect(isDateMoreRecentThan(aDate, otherDate, 60)).toBe(false); // considered equal here
|
||||
});
|
||||
|
||||
it('should correctly compare an after date outside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T12:00:00');
|
||||
expect(isDateMoreRecentThan(aDate, otherDate, 60)).toBe(true);
|
||||
});
|
||||
|
||||
it('should correctly compare an after date inside tolerance', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T12:59:42');
|
||||
expect(isDateMoreRecentThan(aDate, otherDate, 60)).toBe(false); // considered equal here
|
||||
});
|
||||
|
||||
it('should correctly compare an exactly equal date', (): void => {
|
||||
const aDate = new Date('2022-09-09T13:00:00');
|
||||
const otherDate = new Date('2022-09-09T13:00:00');
|
||||
expect(isDateMoreRecentThan(aDate, otherDate, 60)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,31 +1,6 @@
|
||||
/// returns false if the dates are equal within the `equalityToleranceInSeconds` number of seconds
|
||||
/// otherwise returns true if `comparedDate` is after `date`
|
||||
|
||||
export function isDateMoreRecentThan(
|
||||
date: Readonly<Date>,
|
||||
comparedDate: Readonly<Date>,
|
||||
equalityToleranceInSeconds = 0
|
||||
comparedDate: Readonly<Date>
|
||||
): boolean {
|
||||
if (equalityToleranceInSeconds > 0) {
|
||||
const areDatesEqual = isDateEqualTo(
|
||||
date,
|
||||
comparedDate,
|
||||
equalityToleranceInSeconds
|
||||
);
|
||||
|
||||
return !areDatesEqual && date > comparedDate;
|
||||
}
|
||||
|
||||
return date > comparedDate;
|
||||
}
|
||||
|
||||
export function isDateEqualTo(
|
||||
date: Date,
|
||||
otherDate: Date,
|
||||
toleranceInSeconds: number
|
||||
): boolean {
|
||||
const timestamp = date.getTime();
|
||||
const otherTimestamp = otherDate.getTime();
|
||||
const deltaInSeconds = Math.abs(timestamp - otherTimestamp) / 1000;
|
||||
return deltaInSeconds <= toleranceInSeconds;
|
||||
}
|
||||
|
||||
@@ -52,5 +52,4 @@ export interface IIssuesProcessorOptions {
|
||||
ignorePrUpdates: boolean | undefined;
|
||||
exemptDraftPr: boolean;
|
||||
closeIssueReason: string;
|
||||
includeOnlyAssigned: boolean;
|
||||
}
|
||||
|
||||
23
src/main.ts
23
src/main.ts
@@ -28,11 +28,11 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
stalePrMessage: core.getInput('stale-pr-message'),
|
||||
closeIssueMessage: core.getInput('close-issue-message'),
|
||||
closePrMessage: core.getInput('close-pr-message'),
|
||||
daysBeforeStale: parseFloat(
|
||||
daysBeforeStale: parseInt(
|
||||
core.getInput('days-before-stale', {required: true})
|
||||
),
|
||||
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
||||
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
||||
daysBeforeIssueStale: parseInt(core.getInput('days-before-issue-stale')),
|
||||
daysBeforePrStale: parseInt(core.getInput('days-before-pr-stale')),
|
||||
daysBeforeClose: parseInt(
|
||||
core.getInput('days-before-close', {required: true})
|
||||
),
|
||||
@@ -88,19 +88,14 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
|
||||
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
|
||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true',
|
||||
closeIssueReason: core.getInput('close-issue-reason'),
|
||||
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
||||
closeIssueReason: core.getInput('close-issue-reason')
|
||||
};
|
||||
|
||||
for (const numberInput of ['days-before-stale']) {
|
||||
if (isNaN(parseFloat(core.getInput(numberInput)))) {
|
||||
const errorMessage = `Option "${numberInput}" did not parse to a valid float`;
|
||||
core.setFailed(errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
for (const numberInput of ['days-before-close', 'operations-per-run']) {
|
||||
for (const numberInput of [
|
||||
'days-before-stale',
|
||||
'days-before-close',
|
||||
'operations-per-run'
|
||||
]) {
|
||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
||||
core.setFailed(errorMessage);
|
||||
|
||||
Reference in New Issue
Block a user