Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Changelog on github action #42

Open
mibelbahri opened this issue Dec 2, 2024 · 2 comments
Open

Empty Changelog on github action #42

mibelbahri opened this issue Dec 2, 2024 · 2 comments

Comments

@mibelbahri
Copy link

Hello team,

I wanted to automate changelog updates with your github action. but this is generating for me an empty changelog:

---
name: Update Changelog 🗂️

on:
  pull_request:
    branches:
      - '**'

jobs:
  update-changelog:
    name: Generate changelog
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          depth: 0
          ref: ${{ github.head_ref }}

      - name: Generate a changelog
        uses: orhun/git-cliff-action@v4
        id: git-cliff
        with:
          config: ./cliff.toml
          args: --verbose
        env:
          OUTPUT: CHANGELOG.md

      - name: Print the changelog
        run: cat "${{ steps.git-cliff.outputs.changelog }}"

      - name: Commit
        run: |
          git config user.name 'github-actions[bot]'
          git config user.email 'github-actions[bot]@users.noreply.github.com'
          git add CHANGELOG.md
          git commit -m "doc: update changelog"
          git push

Can you please help ?

@orhun
Copy link
Owner

orhun commented Dec 4, 2024

Hello! There are a couple of things that you can share the help me debug this:

  • Is your project open source? If so, can you share the repository link? If not, please let me know about the format of your commits/tags.
  • How does your cliff.toml look like?
  • What are the logs of the GitHub workflow?

@mibelbahri
Copy link
Author

mibelbahri commented Dec 24, 2024

Hello @orhun

Sorry for the late response:

Sorry, not a public repo, I use conventional commits, and my cliff.toml works fine when I run the command locally it works fine, e.g:
git cliff --verbose --strip 'footer' -o CHANGELOG.md --tag v1.3.9

But when I run the action, it overwrites my existing change-log into an empty one, here are the logs:

Run orhun/git-cliff-action@v4
Run ${GITHUB_ACTION_PATH}/install.sh
git-cliff-x86_64-unknown-linux-gnu.tar.gz
Getting git-cliff v2.7.0 from https://api.github.com/repos/orhun/git-cliff/releases/tags/v2.7.0
Found release: https://github.com/orhun/git-cliff/releases/download/v2.7.0/git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz
Downloading git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz...
Unpacking git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz...
git-cliff is ready to use!
Run ${GITHUB_ACTION_PATH}/run.sh --config=./cliff.toml --verbose
+ set -o noglob
+ GIT_CLIFF_BIN=git-cliff
+ [[ Linux == \W\i\n\d\o\w\s ]]
++ stat -c %u:%g .
+ owner=1001:118
++ id -u
+ chown -R 1001 .
+ OUTPUT=CHANGELOG.md
++ dirname CHANGELOG.md
+ mkdir -p .
++ echo --config=./cliff.toml --verbose
++ xargs
+ args='--config=./cliff.toml --verbose'
+ GIT_CLIFF_OUTPUT=CHANGELOG.md
+ ./bin/git-cliff --config=./cliff.toml --verbose
 DEBUG git_cliff > No GitHub remote is set, using remote: XXXX_REPO_NAME_XXXX
 DEBUG git_cliff_core::changelog > Adding remote data...
 DEBUG git_cliff_core::changelog > Processing the commits...
sh: 1: typos: not found
 DEBUG git_cliff_core::changelog > Processing 1 release(s)...
 DEBUG git_cliff_core::changelog > Generating changelog...
+ exit_code=0
++ mktemp
+ CONTEXT=/tmp/tmp.Lc8Jdhf7yH
+ GIT_CLIFF_OUTPUT=/tmp/tmp.Lc8Jdhf7yH
+ ./bin/git-cliff --config=./cliff.toml --verbose --context
 DEBUG git_cliff > No GitHub remote is set, using remote: XXXX_REPO_NAME_XXXX
 DEBUG git_cliff_core::changelog > Adding remote data...
 DEBUG git_cliff_core::changelog > Processing the commits...
sh: 1: typos: not found
 DEBUG git_cliff_core::changelog > Processing 1 release(s)...
+ chown -R 1001:118 .
++ stat -c%s CHANGELOG.md
+ FILESIZE=115
+ MAXSIZE=41943040
+ '[' 115 -le 41943040 ']'
+ echo 'content<<EOF'
+ cat CHANGELOG.md
+ echo EOF
+ cat CHANGELOG.md
# Changelog

All notable changes to this project will be documented in this file.

<!-- generated by git-cliff -->
+ echo changelog=CHANGELOG.md
++ jq -r '.[0].version' /tmp/tmp.Lc8Jdhf7yH
+ echo version=null
+ echo exit_code=0

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants