Skip to content

Commit

Permalink
feat: Add outputs for type, scope and subject (#261 by @bcaurel)
Browse files Browse the repository at this point in the history
* Update validatePrTitle.js

* Update README.md

* Update README.md

---------

Co-authored-by: Jan Amann <[email protected]>
  • Loading branch information
bcaurel and amannn authored Apr 23, 2024
1 parent 67cbd7a commit b05f5f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ There are two events that can be used as triggers for this action, each with dif

## Outputs

In case the validation fails, this action will populate the `error_message` ouput.
- The outputs `type`, `scope` and `subject` are populated, except for if the `wip` option is used.
- The `error_message` output will be populated in case the validation fails.

[An output can be used in other steps](https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs), for example to comment the error message onto the pull request.

Expand Down Expand Up @@ -222,4 +223,3 @@ jobs:
```
</details>
3 changes: 3 additions & 0 deletions src/validatePrTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module.exports = async function validatePrTitle(
parserOpts.headerCorrespondence = headerPatternCorrespondence;
}
const result = parser(prTitle, parserOpts);
core.setOutput('type', result.type);
core.setOutput('scope', result.scope);
core.setOutput('subject', result.subject);

function printAvailableTypes() {
return `Available types:\n${types
Expand Down

0 comments on commit b05f5f6

Please sign in to comment.