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

Config file and output file are not found #10

Closed beeb closed 9 months ago

beeb commented 1 year ago

Trying to use the action with self-hosted runners running in docker. I am not sure if this issue is related to having to use "docker in docker". I know for instance that when using cross-rs in my self-hosted runners I need to enable a flag for docker in docker.

Note that the only step before this one is using actions/checkout@v3 with defaults.

2023-05-01T13:17:07.1284920Z ##[group]Run orhun/git-cliff-action@v2
2023-05-01T13:17:07.1285109Z with:
2023-05-01T13:17:07.1285227Z   config: cliff.toml
2023-05-01T13:17:07.1285350Z   args: --unreleased
2023-05-01T13:17:07.1285476Z env:
2023-05-01T13:17:07.1285595Z   OUTPUT: CHANGELOG.md
2023-05-01T13:17:07.1285718Z ##[endgroup]
2023-05-01T13:17:07.1516302Z ##[command]/usr/bin/docker run --name b1cbc5fb3bff61d8de4d229bad37f1353f8515_df4742 --label b1cbc5 --workdir /github/workspace --rm -e "OUTPUT" -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_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_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/smsl_daemon_rust/smsl_daemon_rust":"/github/workspace" b1cbc5:fb3bff61d8de4d229bad37f1353f8515  "--config=cliff.toml" "--unreleased"
2023-05-01T13:17:07.4711174Z + set -o noglob
2023-05-01T13:17:07.4712657Z ++ stat -c %u:%g .
2023-05-01T13:17:07.4719934Z + owner=0:0
2023-05-01T13:17:07.4742119Z ++ id -u
2023-05-01T13:17:07.4752382Z + chown -R 0 .
2023-05-01T13:17:07.4760730Z + OUTPUT=CHANGELOG.md
2023-05-01T13:17:07.4763223Z ++ dirname CHANGELOG.md
2023-05-01T13:17:07.4769024Z + mkdir -p .
2023-05-01T13:17:07.4781003Z ++ echo --config=cliff.toml --unreleased
2023-05-01T13:17:07.4781373Z ++ xargs
2023-05-01T13:17:07.4794216Z + args='--config=cliff.toml --unreleased'
2023-05-01T13:17:07.4794627Z + GIT_CLIFF_OUTPUT=CHANGELOG.md
2023-05-01T13:17:07.4794860Z + git-cliff --config=cliff.toml --unreleased
2023-05-01T13:17:07.4811609Z  WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
2023-05-01T13:17:07.4815199Z  ERROR git_cliff > Git error: `could not find repository from '/github/workspace'; class=Repository (6); code=NotFound (-3)`
2023-05-01T13:17:07.4820828Z + exit_code=1
2023-05-01T13:17:07.4821160Z + cat CHANGELOG.md
2023-05-01T13:17:07.4827286Z cat: CHANGELOG.md: No such file or directory
2023-05-01T13:17:07.4828888Z + chown -R 0:0 .
2023-05-01T13:17:07.4837959Z + echo 'content<<EOF'
2023-05-01T13:17:07.4839191Z + cat CHANGELOG.md
2023-05-01T13:17:07.4844020Z cat: CHANGELOG.md: No such file or directory
2023-05-01T13:17:07.4845056Z + echo EOF
2023-05-01T13:17:07.4845323Z + echo changelog=CHANGELOG.md
2023-05-01T13:17:07.4845614Z + echo exit_code=1
beeb commented 1 year ago

I also tried to configure the checkout action to checkout the main branch (to get the latest commit that triggered the workflow) and fetch-depth: 0 like in the readme but it didn't make a difference.

beeb commented 1 year ago

Please also note that building from source in CI (with cargo install) and running the command without docker works fine. It's only the container version that fails like above.

orhun commented 1 year ago

Weird, how can I reproduce this? Also, did you get this error for the recently released version (2.0.6) or was it always there?

beeb commented 1 year ago

The reproduce, you can try the following. Spin up a self-hosted runner with this docker command:

docker run -it --name my-runner \
    -e RUNNER_NAME=my-runner \
    -e GITHUB_ACCESS_TOKEN=your_PAT_token \
    -e RUNNER_REPOSITORY_URL=https://github.com/... \
    -v /var/run/docker.sock:/var/run/docker.sock \
    tcardonne/github-runner:ubuntu-20.04

More info at https://github.com/tcardonne/docker-github-runner

Then you can start a workflow in that repository you linked in the command above, using the git-cliff action. You should see the error like me. To use the self-hosted runner, make sure you put runs-on: [self-hosted, linux]

I just started using git-cliff so I have no prior experience with older versions.

beeb commented 1 year ago

Later today or tomorrow I will try to switch to https://github.com/myoung34/docker-github-actions-runner to see if it makes a difference.

beeb commented 1 year ago

Same story with the other self-hosted runner, I think it should be reproducible if you try running either of those containers and run the action on them.

orhun commented 1 year ago

Hey again, sorry for the late reply. I recently released the new version of git-cliff and updated this action accordingly. Is this still an issue?

beeb commented 12 months ago

Hey @orhun thanks for getting back to this issue. I don't have access to a self-hosted runner anymore since I switched jobs. If I get the chance I'll try to spin up one and set up one of my repos to use it, but it might be a while until I can

orhun commented 12 months ago

Okay, just let me know!

dark0dave commented 10 months ago

@orhun I updated to v2.2.0 from v2.0.0 and that fixed the issue. It looks like v2.0.0 is gone or something:

  /usr/bin/docker build -t 1906d0:27cb555a07d84bdea80da72f1e6516e0 -f "/home/runner/work/_actions/orhun/git-cliff-action/v2/Dockerfile" "/home/runner/work/_actions/orhun/git-cliff-action/v2"
  #0 building with "default" instance using docker driver

  #1 [internal] load .dockerignore
  #1 transferring context: 2B done
  #1 DONE 0.0s

  #2 [internal] load build definition from Dockerfile
  #2 transferring dockerfile: 620B done
  #2 DONE 0.0s

  #3 [internal] load metadata for docker.io/orhunp/git-cliff:1.4.0@sha256:5642cc7ac848a79f021056c4903f01d1447d10236561b97b6db3b57f5fac5536
  #3 ...

  #4 [auth] orhunp/git-cliff:pull token for registry-1.docker.io
  #4 DONE 0.0s

  #3 [internal] load metadata for docker.io/orhunp/git-cliff:1.4.0@sha256:5642cc7ac848a79f021056c4903f01d1447d10236561b97b6db3b57f5fac5536
  #3 ERROR: failed to do request: Head "https://registry-1.docker.io/v2/orhunp/git-cliff/manifests/sha256:5642cc7ac848a79f021056c4903f01d1447d10236561b97b6db3b57f5fac5536": EOF

Thank you for git-cliff btw. Its great.

orhun commented 10 months ago

Hmm interesting. I'm glad it is fixed though 🐻