mirror of
https://github.com/actions/stale.git
synced 2025-12-31 20:38:17 +00:00
Compare commits
7 Commits
v6.0.0
...
johnsudol/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fde7d4444e | ||
|
|
e27c9afd63 | ||
|
|
52086c38b6 | ||
|
|
65b52aff67 | ||
|
|
0d6f830071 | ||
|
|
b909bf8927 | ||
|
|
5ebf00ea0e |
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# [6.0.1]
|
||||||
|
|
||||||
|
Update @actions/core to v1.10.0 ([#839](https://github.com/actions/stale/pull/839))
|
||||||
|
|
||||||
# [6.0.0]
|
# [6.0.0]
|
||||||
|
|
||||||
:warning: Breaking change :warning:
|
:warning: Breaking change :warning:
|
||||||
|
|||||||
@@ -246,8 +246,7 @@ Required Permission: `pull-requests: write`
|
|||||||
|
|
||||||
#### exempt-issue-labels
|
#### exempt-issue-labels
|
||||||
|
|
||||||
The label(s) that can exempt to automatically mark as stale the issues.
|
A comma separated list of labels, that prevent the issue from being marked as stale. (e.g: `question,bug,wip`)
|
||||||
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.
|
If unset (or an empty string), this option will not alter the stale workflow.
|
||||||
|
|
||||||
|
|||||||
@@ -1998,6 +1998,84 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
|
|||||||
expect(processor.closedIssues).toHaveLength(0);
|
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 () => {
|
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);
|
expect.assertions(2);
|
||||||
const opts: IIssuesProcessorOptions = {
|
const opts: IIssuesProcessorOptions = {
|
||||||
@@ -2097,6 +2175,105 @@ test('processing a pull request opened since 2 days and with the option "daysBef
|
|||||||
expect(processor.closedIssues).toHaveLength(0);
|
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 () => {
|
test('processing a previously closed issue with a close label will remove the close label', async () => {
|
||||||
expect.assertions(1);
|
expect.assertions(1);
|
||||||
const opts: IIssuesProcessorOptions = {
|
const opts: IIssuesProcessorOptions = {
|
||||||
|
|||||||
83
dist/index.js
vendored
83
dist/index.js
vendored
@@ -381,7 +381,7 @@ class IssuesProcessor {
|
|||||||
this.options = options;
|
this.options = options;
|
||||||
this.client = github_1.getOctokit(this.options.repoToken);
|
this.client = github_1.getOctokit(this.options.repoToken);
|
||||||
this.operations = new stale_operations_1.StaleOperations(this.options);
|
this.operations = new stale_operations_1.StaleOperations(this.options);
|
||||||
this._logger.info(logger_service_1.LoggerService.yellow(`Starting the stale action process...`));
|
this._logger.info(logger_service_1.LoggerService.yellow(`Starting the stale action process... logging`));
|
||||||
if (this.options.debugOnly) {
|
if (this.options.debugOnly) {
|
||||||
this._logger.warning(logger_service_1.LoggerService.yellowBright(`Executing in debug mode!`));
|
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.`));
|
this._logger.warning(logger_service_1.LoggerService.yellowBright(`The debug output will be written but no issues/PRs will be processed.`));
|
||||||
@@ -526,14 +526,15 @@ class IssuesProcessor {
|
|||||||
issueLogger.info(`This $$type has a stale label`);
|
issueLogger.info(`This $$type has a stale label`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
issueLogger.info(`This $$type hasn't a stale label`);
|
issueLogger.info(`This $$type doesn't have a stale label`);
|
||||||
}
|
}
|
||||||
const exemptLabels = words_to_list_1.wordsToList(issue.isPullRequest
|
const exemptLabels = words_to_list_1.wordsToList(issue.isPullRequest
|
||||||
? this.options.exemptPrLabels
|
? this.options.exemptPrLabels
|
||||||
: this.options.exemptIssueLabels);
|
: this.options.exemptIssueLabels);
|
||||||
if (exemptLabels.some((exemptLabel) => is_labeled_1.isLabeled(issue, exemptLabel))) {
|
if (exemptLabels.some((exemptLabel) => is_labeled_1.isLabeled(issue, exemptLabel))) {
|
||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
// issueLogger.info(`An exempt label was added after the stale label.`);
|
||||||
|
issueLogger.info(`This $$type has an exempt label, removing the stale label.`);
|
||||||
yield this._removeStaleLabel(issue, staleLabel);
|
yield this._removeStaleLabel(issue, staleLabel);
|
||||||
}
|
}
|
||||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
||||||
@@ -2183,9 +2184,9 @@ function _getAndValidateArgs() {
|
|||||||
stalePrMessage: core.getInput('stale-pr-message'),
|
stalePrMessage: core.getInput('stale-pr-message'),
|
||||||
closeIssueMessage: core.getInput('close-issue-message'),
|
closeIssueMessage: core.getInput('close-issue-message'),
|
||||||
closePrMessage: core.getInput('close-pr-message'),
|
closePrMessage: core.getInput('close-pr-message'),
|
||||||
daysBeforeStale: parseInt(core.getInput('days-before-stale', { required: true })),
|
daysBeforeStale: parseFloat(core.getInput('days-before-stale', { required: true })),
|
||||||
daysBeforeIssueStale: parseInt(core.getInput('days-before-issue-stale')),
|
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
||||||
daysBeforePrStale: parseInt(core.getInput('days-before-pr-stale')),
|
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
||||||
daysBeforeClose: parseInt(core.getInput('days-before-close', { required: true })),
|
daysBeforeClose: parseInt(core.getInput('days-before-close', { required: true })),
|
||||||
daysBeforeIssueClose: parseInt(core.getInput('days-before-issue-close')),
|
daysBeforeIssueClose: parseInt(core.getInput('days-before-issue-close')),
|
||||||
daysBeforePrClose: parseInt(core.getInput('days-before-pr-close')),
|
daysBeforePrClose: parseInt(core.getInput('days-before-pr-close')),
|
||||||
@@ -2233,11 +2234,14 @@ function _getAndValidateArgs() {
|
|||||||
closeIssueReason: core.getInput('close-issue-reason'),
|
closeIssueReason: core.getInput('close-issue-reason'),
|
||||||
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
||||||
};
|
};
|
||||||
for (const numberInput of [
|
for (const numberInput of ['days-before-stale']) {
|
||||||
'days-before-stale',
|
if (isNaN(parseFloat(core.getInput(numberInput)))) {
|
||||||
'days-before-close',
|
const errorMessage = `Option "${numberInput}" did not parse to a valid float`;
|
||||||
'operations-per-run'
|
core.setFailed(errorMessage);
|
||||||
]) {
|
throw new Error(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const numberInput of ['days-before-close', 'operations-per-run']) {
|
||||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||||
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
||||||
core.setFailed(errorMessage);
|
core.setFailed(errorMessage);
|
||||||
@@ -2484,7 +2488,6 @@ const file_command_1 = __nccwpck_require__(717);
|
|||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
const path = __importStar(__nccwpck_require__(5622));
|
const path = __importStar(__nccwpck_require__(5622));
|
||||||
const uuid_1 = __nccwpck_require__(5840);
|
|
||||||
const oidc_utils_1 = __nccwpck_require__(8041);
|
const oidc_utils_1 = __nccwpck_require__(8041);
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
@@ -2514,20 +2517,9 @@ function exportVariable(name, val) {
|
|||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
|
||||||
// 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;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@@ -2545,7 +2537,7 @@ exports.setSecret = setSecret;
|
|||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
file_command_1.issueFileCommand('PATH', inputPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
@@ -2585,7 +2577,10 @@ function getMultilineInput(name, options) {
|
|||||||
const inputs = getInput(name, options)
|
const inputs = getInput(name, options)
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(x => x !== '');
|
.filter(x => x !== '');
|
||||||
return inputs;
|
if (options && options.trimWhitespace === false) {
|
||||||
|
return inputs;
|
||||||
|
}
|
||||||
|
return inputs.map(input => input.trim());
|
||||||
}
|
}
|
||||||
exports.getMultilineInput = getMultilineInput;
|
exports.getMultilineInput = getMultilineInput;
|
||||||
/**
|
/**
|
||||||
@@ -2618,8 +2613,12 @@ exports.getBooleanInput = getBooleanInput;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
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);
|
process.stdout.write(os.EOL);
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
/**
|
/**
|
||||||
@@ -2748,7 +2747,11 @@ exports.group = group;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function saveState(name, value) {
|
function saveState(name, value) {
|
||||||
command_1.issueCommand('save-state', { 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));
|
||||||
}
|
}
|
||||||
exports.saveState = saveState;
|
exports.saveState = saveState;
|
||||||
/**
|
/**
|
||||||
@@ -2814,13 +2817,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.issueCommand = void 0;
|
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
|
||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
const fs = __importStar(__nccwpck_require__(5747));
|
const fs = __importStar(__nccwpck_require__(5747));
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
|
const uuid_1 = __nccwpck_require__(5840);
|
||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
function issueCommand(command, message) {
|
function issueFileCommand(command, message) {
|
||||||
const filePath = process.env[`GITHUB_${command}`];
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
@@ -2832,7 +2836,22 @@ function issueCommand(command, message) {
|
|||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.issueCommand = issueCommand;
|
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;
|
||||||
//# sourceMappingURL=file-command.js.map
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.0.1",
|
"@actions/github": "^5.0.1",
|
||||||
"lodash.deburr": "^4.1.0",
|
"lodash.deburr": "^4.1.0",
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
@@ -11187,9 +11187,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.0.1",
|
"@actions/github": "^5.0.1",
|
||||||
"lodash.deburr": "^4.1.0",
|
"lodash.deburr": "^4.1.0",
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export class IssuesProcessor {
|
|||||||
this.operations = new StaleOperations(this.options);
|
this.operations = new StaleOperations(this.options);
|
||||||
|
|
||||||
this._logger.info(
|
this._logger.info(
|
||||||
LoggerService.yellow(`Starting the stale action process...`)
|
LoggerService.yellow(`Starting the stale action process... logging`)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.options.debugOnly) {
|
if (this.options.debugOnly) {
|
||||||
@@ -323,7 +323,7 @@ export class IssuesProcessor {
|
|||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`This $$type has a stale label`);
|
issueLogger.info(`This $$type has a stale label`);
|
||||||
} else {
|
} else {
|
||||||
issueLogger.info(`This $$type hasn't a stale label`);
|
issueLogger.info(`This $$type doesn't have a stale label`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptLabels: string[] = wordsToList(
|
const exemptLabels: string[] = wordsToList(
|
||||||
@@ -338,7 +338,10 @@ export class IssuesProcessor {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
// issueLogger.info(`An exempt label was added after the stale label.`);
|
||||||
|
issueLogger.info(
|
||||||
|
`This $$type has an exempt label, removing the stale label.`
|
||||||
|
);
|
||||||
await this._removeStaleLabel(issue, staleLabel);
|
await this._removeStaleLabel(issue, staleLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
src/main.ts
20
src/main.ts
@@ -28,11 +28,11 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
|||||||
stalePrMessage: core.getInput('stale-pr-message'),
|
stalePrMessage: core.getInput('stale-pr-message'),
|
||||||
closeIssueMessage: core.getInput('close-issue-message'),
|
closeIssueMessage: core.getInput('close-issue-message'),
|
||||||
closePrMessage: core.getInput('close-pr-message'),
|
closePrMessage: core.getInput('close-pr-message'),
|
||||||
daysBeforeStale: parseInt(
|
daysBeforeStale: parseFloat(
|
||||||
core.getInput('days-before-stale', {required: true})
|
core.getInput('days-before-stale', {required: true})
|
||||||
),
|
),
|
||||||
daysBeforeIssueStale: parseInt(core.getInput('days-before-issue-stale')),
|
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
||||||
daysBeforePrStale: parseInt(core.getInput('days-before-pr-stale')),
|
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
||||||
daysBeforeClose: parseInt(
|
daysBeforeClose: parseInt(
|
||||||
core.getInput('days-before-close', {required: true})
|
core.getInput('days-before-close', {required: true})
|
||||||
),
|
),
|
||||||
@@ -92,11 +92,15 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
|||||||
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const numberInput of [
|
for (const numberInput of ['days-before-stale']) {
|
||||||
'days-before-stale',
|
if (isNaN(parseFloat(core.getInput(numberInput)))) {
|
||||||
'days-before-close',
|
const errorMessage = `Option "${numberInput}" did not parse to a valid float`;
|
||||||
'operations-per-run'
|
core.setFailed(errorMessage);
|
||||||
]) {
|
throw new Error(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const numberInput of ['days-before-close', 'operations-per-run']) {
|
||||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||||
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
const errorMessage = `Option "${numberInput}" did not parse to a valid integer`;
|
||||||
core.setFailed(errorMessage);
|
core.setFailed(errorMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user