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:
Falk Puschner 2021-06-03 15:18:48 +02:00 committed by GitHub
parent 1648064648
commit 3e6d35b685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1924 additions and 1932 deletions

View File

@ -19,7 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./
id: stale
with:
stale-issue-message: 'This issue is stale'
stale-pr-message: 'This PR is stale'
debug-only: true
- name: print outputs
run: echo ${{ join(steps.stale.outputs.*, ',') }}

View File

@ -21,19 +21,19 @@ $ npm test
Run the tests and display only the first failing tests :heavy_check_mark:
```bash
$ npm test:only-errors
$ npm run test:only-errors
```
Run the tests with the watch mode :heavy_check_mark:
```bash
$ npm test:watch
$ npm run test:watch
```
Run the linter and fix (almost) every issue for you :heavy_check_mark:
```bash
$ npm lint:all:fix
$ npm run lint:all:fix
```
# Before creating a PR
@ -43,7 +43,7 @@ $ npm lint:all:fix
Build, lint, package and test everything.
```bash
$ npm all
$ npm run all
```
# Release

View File

@ -10,7 +10,7 @@ The default configuration will:
## All options
### List of options
### List of input options
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 | |
| [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
#### repo-token

View File

@ -168,6 +168,11 @@ inputs:
description: 'Display some statistics at the end regarding the stale workflow (only when the logs are enabled).'
default: 'true'
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:
using: 'node12'
main: 'dist/index.js'

3779
dist/index.js vendored

File diff suppressed because it is too large Load Diff

35
package-lock.json generated
View File

@ -7026,8 +7026,7 @@
},
"ws": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz",
"integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==",
"resolved": "",
"dev": true
},
"yargs": {
@ -10292,6 +10291,32 @@
"yargs": "^16.0.0"
},
"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": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -11245,9 +11270,9 @@
}
},
"ws": {
"version": "7.4.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
"integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==",
"version": "7.4.6",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"dev": true
},
"xml-name-validator": {

View File

@ -2,12 +2,19 @@ import * as core from '@actions/core';
import {IssuesProcessor} from './classes/issues-processor';
import {isValidDate} from './functions/dates/is-valid-date';
import {IIssuesProcessorOptions} from './interfaces/issues-processor-options';
import {Issue} from './classes/issue';
async function _run(): Promise<void> {
try {
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) {
core.error(error);
core.setFailed(error.message);
@ -103,6 +110,14 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
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(
argumentName: Readonly<string>
): boolean | undefined {