chore(project): add action files

This commit is contained in:
orhun
2021-06-18 00:27:35 +03:00
parent c83b82a967
commit 29b917f0c8
4 changed files with 90 additions and 0 deletions

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM orhunp/git-cliff:latest
LABEL maintainer="orhun <orhunparmaksiz@gmail.com>"
LABEL repository="https://github.com/orhun/git-cliff-action"
LABEL homepage="https://github.com/orhun/git-cliff"
LABEL com.github.actions.name="Changelog Generator"
LABEL com.github.actions.description="Generate changelog based on your Git history"
LABEL com.github.actions.icon="triangle"
LABEL com.github.actions.color="orange"
COPY README.md /
COPY LICENSE /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

34
README.md Normal file
View File

@@ -0,0 +1,34 @@
# git-cliff changelog generator action
This action generates a changelog based on your Git history using [git-cliff](https://github.com/orhun/git-cliff), on the fly!
## Usage
### Inputs
* `args`: Arguments to pass to git-cliff. Default `"-v"`
### Outputs
* `changelog`: The generated changelog.
### Examples
```
- name: Changelog Generator
uses: orhun/git-cliff-action@v1
with:
args: --verbose
```
## Credits
This action is based on [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) and uses [git-cliff](https://github.com/orhun/git-cliff).
## License
GNU General Public License ([v3.0](https://www.gnu.org/licenses/gpl.txt))
## Copyright
Copyright © 2021, [Orhun Parmaksız](mailto:orhunparmaksiz@gmail.com)

18
action.yml Normal file
View File

@@ -0,0 +1,18 @@
name: "git-cliff: Changelog Generator"
description: "Generate changelog based on your Git history"
inputs:
args:
description: "git-cliff arguments"
required: false
default: "-v"
outputs:
changelog:
description: 'generated changelog'
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.args }}
branding:
icon: "triangle"
color: "orange"

21
entrypoint.sh Executable file
View File

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