orhun / git-cliff-action

GitHub action to generate a changelog based on the Git history
https://github.com/orhun/git-cliff
Apache License 2.0
117 stars 14 forks source link

ERROR git_cliff > Git error: `revspec 'latest' not found; class=Reference (4); code=NotFound (-3)` #23

Closed Gnyblast closed 2 months ago

Gnyblast commented 2 months ago

I have the below error even though I have latest tag created in my repo. And locally with git-cliff I cannot reproduce this error, everything works except the github-actions container.

/usr/bin/docker run --name e44620122e920d74735b4b09280c9c8f16d_539350 --label 096e44 --workdir /github/workspace --rm -e "INPUT_CONFIG" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/WallSync/WallSync":"/github/workspace" 096e44:620122e920d74735b4b09280c9c8f16d  "--config=cliff.toml" "latest.."
+ set -o noglob
++ stat -c %u:%g .
+ owner=1001:127
++ id -u
+ chown -R 0 .
+ OUTPUT=git-cliff/CHANGELOG.md
++ dirname git-cliff/CHANGELOG.md
+ mkdir -p git-cliff
++ echo --config=cliff.toml latest..
++ xargs
+ args='--config=cliff.toml latest..'
+ GIT_CLIFF_OUTPUT=git-cliff/CHANGELOG.md
+ git-cliff --config=cliff.toml latest..
 ERROR git_cliff > Git error: `revspec 'latest' not found; class=Reference (4); code=NotFound (-3)`
+ exit_code=1
++ mktemp
+ CONTEXT=/tmp/tmp.qO5KQOv1sg
+ GIT_CLIFF_OUTPUT=/tmp/tmp.qO5KQOv1sg
+ git-cliff --config=cliff.toml latest.. --context
 ERROR git_cliff > Git error: `revspec 'latest' not found; class=Reference (4); code=NotFound (-3)`
+ cat git-cliff/CHANGELOG.md
cat: git-cliff/CHANGELOG.md: No such file or directory
+ chown -R 1001:127 .
+ echo 'content<<EOF'
+ cat git-cliff/CHANGELOG.md
cat: git-cliff/CHANGELOG.md: No such file or directory
+ echo EOF
+ echo changelog=git-cliff/CHANGELOG.md
++ jq -r '.[0].version' /tmp/tmp.qO5KQOv1sg
+ echo version=
+ echo exit_code=1
Gnyblast commented 2 months ago

Idk if I'm mistaken or noone noticed it, you didn't set WORKDIR as /github/workspace which is the repo mount point or either to have cd "${GITHUB_WORKSPACE}" || exit in your entrypoint.sh.

So what I'm seeing when running the action, is that it does not know where the repository is.

Gnyblast commented 2 months ago
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

was needed. Closed.

Gnyblast commented 2 months ago

Maybe consider updating the documentation because it tooks me to fork the code and add my commands to entrypoint to understand that it was just checking out the top commit with no history backwards.

Then I was this in the example you put, and it suddenly rang the bell. I think that should be explicitly mentioned.

orhun commented 2 months ago

fetch-depth is already a part of the examples. Do you mean explicitly adding a warning?

I'd appreciate a PR :)

Gnyblast commented 2 months ago

fetch-depth is already a part of the examples. Do you mean explicitly adding a warning?

I'd appreciate a PR :)

Yeah exactly because without it, almost nothing works. So it's an explicity dependency.

I will fork and create a PR no worries.

Gnyblast commented 2 months ago

I guess this can be closed since #25 merged in.