Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add outputs for type, scope and subject #261

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
- In any case, this action will populate the `type`, `scope` and `subject` ouputs.
- In case the validation fails, this action will populate the `error_message` ouput.
amannn marked this conversation as resolved.
Show resolved Hide resolved

[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