refactor(action): use OUTPUT environment variable as output path

This commit is contained in:
orhun
2021-06-18 18:59:56 +03:00
parent bd34a55954
commit 3b33c9dab6
3 changed files with 10 additions and 9 deletions

View File

@@ -17,5 +17,7 @@ jobs:
with:
config: fixtures/cliff.toml
args: --verbose
env:
OUTPUT: fixtures/CHANGELOG.md
- name: Print the changelog
run: echo "${{ steps.git-cliff.outputs.changelog }}"
run: cat "${{ steps.git-cliff.outputs.changelog }}"

View File

@@ -11,7 +11,7 @@ inputs:
default: "-v"
outputs:
changelog:
description: "generated changelog"
description: "output file"
runs:
using: "docker"
image: "Dockerfile"

View File

@@ -1,21 +1,20 @@
#!/bin/bash -l
set -uxo pipefail
CHANGELOG_OUT=${CHANGELOG_OUT:="git-cliff/CHANGELOG.md"}
OUTPUT=${OUTPUT:="git-cliff/CHANGELOG.md"}
# Create the output directory
mkdir -p "$(dirname $CHANGELOG_OUT)"
mkdir -p "$(dirname $OUTPUT)"
# Execute git-cliff
git-cliff "$@" > "$CHANGELOG_OUT"
git-cliff "$@" > "$OUTPUT"
exit_code=$?
# Output to console
cat "$CHANGELOG_OUT"
echo
cat "$OUTPUT"
# Set output
echo "::set-output name=changelog::$CHANGELOG_OUT"
# Set output file
echo "::set-output name=changelog::$OUTPUT"
# Pass exit code to the next step
echo "::set-output name=exit_code::$exit_code"