Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
uses: ./
with:
config: fixtures/cliff.toml
args: --verbose --strip 'footer' --exclude-path '.github/**'
args: --verbose --strip 'footer' --exclude-path '.github/**' --tag 0.0.0
env:
OUTPUT: fixtures/CHANGELOG.md
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
- name: Print the version
run: echo "${{ steps.git-cliff.outputs.version }}"
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ COPY README.md /
COPY LICENSE /
COPY entrypoint.sh /entrypoint.sh

RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/entrypoint.sh"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This action generates a changelog based on your Git history using [git-cliff](ht

- `changelog`: Output file that contains the generated changelog.
- `content`: Content of the changelog.
- `version`: Version of the latest release.

### Environment variables

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ outputs:
description: "output file"
content:
description: "content of the changelog"
version:
description: "version of the latest release"
runs:
using: "docker"
image: "Dockerfile"
Expand Down
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ args=$(echo "$@" | xargs)
GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args
exit_code=$?

# Retrieve context
CONTEXT="$(mktemp)"
GIT_CLIFF_OUTPUT="$CONTEXT" git-cliff $args --context

# Output to console
cat "$OUTPUT"

Expand All @@ -33,5 +37,8 @@ echo "EOF" >>$GITHUB_OUTPUT
# Set output file
echo "changelog=$OUTPUT" >>$GITHUB_OUTPUT

# Set the version output to the version of the latest release
echo "version=$(jq -r '.[0].version' $CONTEXT)" >>$GITHUB_OUTPUT

# Pass exit code to the next step
echo "exit_code=$exit_code" >>$GITHUB_OUTPUT