mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-22 07:25:43 +08:00
feat(action): add an output for the changelog content (#4)
* 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 * fix: update multiline output usage https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings * docs(readme): add content as output Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ This action generates a changelog based on your Git history using [git-cliff](ht
|
|||||||
### Output variables
|
### Output variables
|
||||||
|
|
||||||
- `changelog`: Output file that contains the generated changelog.
|
- `changelog`: Output file that contains the generated changelog.
|
||||||
|
- `content`: Content of the changelog.
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ inputs:
|
|||||||
outputs:
|
outputs:
|
||||||
changelog:
|
changelog:
|
||||||
description: "output file"
|
description: "output file"
|
||||||
|
content:
|
||||||
|
description: "content of the changelog"
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: "docker"
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
|
|||||||
@@ -23,10 +23,15 @@ exit_code=$?
|
|||||||
|
|
||||||
# Output to console
|
# Output to console
|
||||||
cat "$OUTPUT"
|
cat "$OUTPUT"
|
||||||
OUTPUT="$WORKDIR/$OUTPUT"
|
|
||||||
|
# Set the changelog content
|
||||||
|
echo "content<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
cat "$OUTPUT" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Set output file
|
# Set output file
|
||||||
echo "::set-output name=changelog::$OUTPUT"
|
OUTPUT="$WORKDIR/$OUTPUT"
|
||||||
|
echo "changelog=$OUTPUT" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Pass exit code to the next step
|
# Pass exit code to the next step
|
||||||
echo "::set-output name=exit_code::$exit_code"
|
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in New Issue
Block a user