Closed amitav13 closed 8 months ago
Hello!
You can probably do something like this:
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 upstream
First it creates the changelog as CHANGELOG.md
and commits it to the repo as GitHub Actions bot user.
I hope this is helpful 🐻 let me know if it works for you and we can probably mention this in README.md
Hey no, getting this error:
Was getting the same one when I had the ${GITHUB_REPOSITORY}
tag as well.
Here's my action yaml:
name: "Tagged release"
on:
push:
tags:
- "[0-9].[0-9].[0-9]*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Commit changes to changelog
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 "ci: Update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/Get-Salesmonk/saasmonk-chat.git upstream
Wait I made a mistake while sharing the example workflow, upstream
should actually match the name of the branch that you want to push to (e.g. main
).
Can you try again with the correct branch name?
It worked perfectly for my use case, thank you very much!
Thanks for confirming! I added this example to the README.md in 9f1ad1d8d071d219d67918b2262a5658c703a7b6
Hi, Might be doing something dumb, but - is there no way to write the changelog to a
CHANGELOG.md
within the repo itself? Is that not something that's usual?Thanks for the action!