feat(options): add new option ignore-updates to stale even with activity (#540)

* chore(assignees): add logs

* docs(readme): use the override syntax to simplify the reading

* docs(readme): add missing default options

* docs(readme): add 3 new options to ignore activity before stale

* chore(action): add 3 new options

* fix(removeStaleWhenUpdated): use the value of the action config as expected

Fixes #451

* chore(main): add 3 new options

* feat(ignore): add new class to ignore all activities before stale

* feat(option): add new options to ignore all activities before stale

* chore(index): update index file

* docs(readme): fix typo

* docs(readme): add missing empty row

* chore(rebase): fix logger issues due to rebase

* chore: aplly changes due to rebase

* refactor(naming): change the name of the options as suggested

* chore(logs): reverse the logs as well

* docs(readme): format the table of options

* refactor(naming): rename the the options

* style(rename): rename more updates wording to activities

* build(ci): run the test step as expected for a CI

instead of using a real linter with auto fix and the tests verbose as fuck

* chore: handle breaking changes due to new changes

* refactor(naming): rename and reverse the options

* style(tests): use plural for some describe

* docs(days-before-stale): list the new option

* chore(index): update index file

* chore: keep static methods on top

* chore(logs): remove useless log
This commit is contained in:
Geoffrey Testelin
2021-09-17 15:54:38 +02:00
committed by GitHub
parent 002bc97450
commit 1cdda06bb3
24 changed files with 2268 additions and 1015 deletions

View File

@@ -57,10 +57,10 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
core.getInput('remove-stale-when-updated') === 'false'
),
removeIssueStaleWhenUpdated: _toOptionalBoolean(
core.getInput('remove-issue-stale-when-updated')
'remove-issue-stale-when-updated'
),
removePrStaleWhenUpdated: _toOptionalBoolean(
core.getInput('remove-pr-stale-when-updated')
'remove-pr-stale-when-updated'
),
debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true',
@@ -83,7 +83,10 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
exemptAllPrAssignees: _toOptionalBoolean('exempt-all-pr-assignees'),
enableStatistics: core.getInput('enable-statistics') === 'true',
labelsToRemoveWhenUnstale: core.getInput('labels-to-remove-when-unstale'),
labelsToAddWhenUnstale: core.getInput('labels-to-add-when-unstale')
labelsToAddWhenUnstale: core.getInput('labels-to-add-when-unstale'),
ignoreUpdates: core.getInput('ignore-updates') === 'true',
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates')
};
for (const numberInput of [
@@ -120,6 +123,17 @@ async function processOutput(
core.setOutput('closed-issues-prs', JSON.stringify(closedIssues));
}
/**
* @description
* From an argument name, get the value as an optional boolean
* This is very useful for all the arguments that override others
* It will allow us to easily use the original one when the return value is `undefined`
* Which is different from `true` or `false` that consider the argument as set
*
* @param {Readonly<string>} argumentName The name of the argument to check
*
* @returns {boolean | undefined} The value matching the given argument name
*/
function _toOptionalBoolean(
argumentName: Readonly<string>
): boolean | undefined {