From ce9cd1a4f7b30a8eb8b515fe1e172eb46a1a2ac3 Mon Sep 17 00:00:00 2001 From: Matt Loberg Date: Thu, 3 Nov 2022 17:59:55 -0500 Subject: [PATCH 1/3] feat: add an output for the changelog content ::set-output is [deprecated](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) in favor of [environment files](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files). This has better multiline support, so add the contents of the changelog as an output for cases where you are creating a GitHub release. BREAKING CHANGE: self-hosted runners will need to be at 2.297.0 or greater --- action.yml | 2 ++ entrypoint.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 37d6bf1..d3a1c12 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,8 @@ inputs: outputs: changelog: description: "output file" + content: + description: "content of the changelog" runs: using: "docker" image: "Dockerfile" diff --git a/entrypoint.sh b/entrypoint.sh index b8036b3..23fd995 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,7 +14,12 @@ exit_code=$? cat "$OUTPUT" # Set output file -echo "::set-output name=changelog::$OUTPUT" +echo "changelog=$OUTPUT" >> $GITHUB_OUTPUT + +# Set the changelog content +echo "content<> $GITHUB_OUTPUT +cat "$OUTPUT" >> $GITHUB_OUTPUT +echo "EOF" # Pass exit code to the next step -echo "::set-output name=exit_code::$exit_code" +echo "exit_code=$exit_code" >> $GITHUB_OUTPUT From 2d27ba24fd7f27ff95af922657f0c17f09b8da42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Thu, 1 Dec 2022 23:08:50 +0300 Subject: [PATCH 2/3] fix: update multiline output usage https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings --- entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6a2908c..29b305c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,15 +23,15 @@ exit_code=$? # Output to console cat "$OUTPUT" -OUTPUT="$WORKDIR/$OUTPUT" - -# Set output file -echo "changelog=$OUTPUT" >> $GITHUB_OUTPUT # Set the changelog content echo "content<> $GITHUB_OUTPUT cat "$OUTPUT" >> $GITHUB_OUTPUT -echo "EOF" +echo "EOF" >> $GITHUB_OUTPUT + +# Set output file +OUTPUT="$WORKDIR/$OUTPUT" +echo "changelog=$OUTPUT" >> $GITHUB_OUTPUT # Pass exit code to the next step echo "exit_code=$exit_code" >> $GITHUB_OUTPUT From e3cc533835e0e402431a8a1d53f957b3fad36dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Thu, 1 Dec 2022 23:12:15 +0300 Subject: [PATCH 3/3] docs(readme): add content as output --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bfa70a2..7a2345a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This action generates a changelog based on your Git history using [git-cliff](ht ### Output variables - `changelog`: Output file that contains the generated changelog. +- `content`: Content of the changelog. ### Environment variables