docs(readme): add example about writing the changelog (#13)

This commit is contained in:
Orhun Parmaksız
2024-01-03 17:05:43 +03:00
parent 3641ed2c0a
commit 9f1ad1d8d0

View File

@@ -101,6 +101,41 @@ jobs:
body: ${{ needs.changelog.outputs.release_body }}
```
#### Committing the changelog
You can use this action as follows if you want to generate a changelog and commit it to the repository:
```yml
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
- name: Commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit -m "Update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git <branch>
```
Please note that you need to change the `<branch>` to the branch name that you want to push.
## 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).