feat(output): print output parameters (#458)
* ✨ print output parameters * 📝 add output table * ⚗️ try output parameters * ⚗️ stringify output * ⚗️ try test output * 🔥 remove test output * 💚 build and lint code * 🔥 remove output test * 🔒 fix vulnerabilities * 🎨 renaming staled variables * 🎨 build code * 📝 update contributing commands
This commit is contained in:
parent
1648064648
commit
3e6d35b685
|
@ -19,7 +19,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./
|
- uses: ./
|
||||||
|
id: stale
|
||||||
with:
|
with:
|
||||||
stale-issue-message: 'This issue is stale'
|
stale-issue-message: 'This issue is stale'
|
||||||
stale-pr-message: 'This PR is stale'
|
stale-pr-message: 'This PR is stale'
|
||||||
debug-only: true
|
debug-only: true
|
||||||
|
- name: print outputs
|
||||||
|
run: echo ${{ join(steps.stale.outputs.*, ',') }}
|
||||||
|
|
|
@ -21,19 +21,19 @@ $ npm test
|
||||||
Run the tests and display only the first failing tests :heavy_check_mark:
|
Run the tests and display only the first failing tests :heavy_check_mark:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm test:only-errors
|
$ npm run test:only-errors
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the tests with the watch mode :heavy_check_mark:
|
Run the tests with the watch mode :heavy_check_mark:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm test:watch
|
$ npm run test:watch
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the linter and fix (almost) every issue for you :heavy_check_mark:
|
Run the linter and fix (almost) every issue for you :heavy_check_mark:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm lint:all:fix
|
$ npm run lint:all:fix
|
||||||
```
|
```
|
||||||
|
|
||||||
# Before creating a PR
|
# Before creating a PR
|
||||||
|
@ -43,7 +43,7 @@ $ npm lint:all:fix
|
||||||
Build, lint, package and test everything.
|
Build, lint, package and test everything.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm all
|
$ npm run all
|
||||||
```
|
```
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
|
|
|
@ -10,7 +10,7 @@ The default configuration will:
|
||||||
|
|
||||||
## All options
|
## All options
|
||||||
|
|
||||||
### List of options
|
### List of input options
|
||||||
|
|
||||||
Every argument is optional.
|
Every argument is optional.
|
||||||
|
|
||||||
|
@ -61,6 +61,13 @@ Every argument is optional.
|
||||||
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for PRs only | |
|
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Override [exempt-all-assignees](#exempt-all-assignees) for PRs only | |
|
||||||
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
||||||
|
|
||||||
|
### List of output options
|
||||||
|
|
||||||
|
| Output | Description |
|
||||||
|
| ----------------- | -------------------------------------------- |
|
||||||
|
| staled-issues-prs | List of all staled issues and pull requests. |
|
||||||
|
| closed-issues-prs | List of all closed issues and pull requests. |
|
||||||
|
|
||||||
### Detailed options
|
### Detailed options
|
||||||
|
|
||||||
#### repo-token
|
#### repo-token
|
||||||
|
|
|
@ -168,6 +168,11 @@ inputs:
|
||||||
description: 'Display some statistics at the end regarding the stale workflow (only when the logs are enabled).'
|
description: 'Display some statistics at the end regarding the stale workflow (only when the logs are enabled).'
|
||||||
default: 'true'
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
|
outputs:
|
||||||
|
closed-issues-prs:
|
||||||
|
description: 'List of all closed issues and pull requests.'
|
||||||
|
staled-issues-prs:
|
||||||
|
description: 'List of all staled issues and pull requests.'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7026,8 +7026,7 @@
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.4.0",
|
"version": "7.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz",
|
"resolved": "",
|
||||||
"integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==",
|
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
|
@ -10292,6 +10291,32 @@
|
||||||
"yargs": "^16.0.0"
|
"yargs": "^16.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"ansi-styles": {
|
||||||
|
"version": "3.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
|
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-convert": "^1.9.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": {
|
||||||
|
"version": "1.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||||
|
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-name": "1.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color-name": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||||
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||||
|
@ -11245,9 +11270,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.4.2",
|
"version": "7.4.6",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
|
||||||
"integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==",
|
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"xml-name-validator": {
|
"xml-name-validator": {
|
||||||
|
|
17
src/main.ts
17
src/main.ts
|
@ -2,12 +2,19 @@ import * as core from '@actions/core';
|
||||||
import {IssuesProcessor} from './classes/issues-processor';
|
import {IssuesProcessor} from './classes/issues-processor';
|
||||||
import {isValidDate} from './functions/dates/is-valid-date';
|
import {isValidDate} from './functions/dates/is-valid-date';
|
||||||
import {IIssuesProcessorOptions} from './interfaces/issues-processor-options';
|
import {IIssuesProcessorOptions} from './interfaces/issues-processor-options';
|
||||||
|
import {Issue} from './classes/issue';
|
||||||
|
|
||||||
async function _run(): Promise<void> {
|
async function _run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const args = _getAndValidateArgs();
|
const args = _getAndValidateArgs();
|
||||||
|
|
||||||
await new IssuesProcessor(args).processIssues();
|
const issueProcessor: IssuesProcessor = new IssuesProcessor(args);
|
||||||
|
await issueProcessor.processIssues();
|
||||||
|
|
||||||
|
await processOutput(
|
||||||
|
issueProcessor.closedIssues,
|
||||||
|
issueProcessor.staleIssues
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(error);
|
core.error(error);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
@ -103,6 +110,14 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function processOutput(
|
||||||
|
staledIssues: Issue[],
|
||||||
|
closedIssues: Issue[]
|
||||||
|
): Promise<void> {
|
||||||
|
core.setOutput('staled-issues-prs', JSON.stringify(staledIssues));
|
||||||
|
core.setOutput('closed-issues-prs', JSON.stringify(closedIssues));
|
||||||
|
}
|
||||||
|
|
||||||
function _toOptionalBoolean(
|
function _toOptionalBoolean(
|
||||||
argumentName: Readonly<string>
|
argumentName: Readonly<string>
|
||||||
): boolean | undefined {
|
): boolean | undefined {
|
||||||
|
|
Loading…
Reference in New Issue