From b05f5f6423ef5cdfc7fdff00c4c10dd9a4f54aff Mon Sep 17 00:00:00 2001 From: Brandon Caurel Date: Tue, 23 Apr 2024 17:15:04 +0200 Subject: [PATCH] feat: Add outputs for `type`, `scope` and `subject` (#261 by @bcaurel) * Update validatePrTitle.js * Update README.md * Update README.md --------- Co-authored-by: Jan Amann --- README.md | 4 ++-- src/validatePrTitle.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f57bac1bb..a6e405108 100644 --- a/README.md +++ b/README.md @@ -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. @@ -222,4 +223,3 @@ jobs: ``` - diff --git a/src/validatePrTitle.js b/src/validatePrTitle.js index 6dff4ac79..c510ed4cd 100644 --- a/src/validatePrTitle.js +++ b/src/validatePrTitle.js @@ -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