diff --git a/README.md b/README.md index fdf9d8a..9bdace2 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +Please note that you need to change the `` 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).