← Back to issue list

snapcraft: pack: git checkout fails when run from inside a composite action

View original Github issue

Metadata

Project
craft-actions
Number
#71
Type
issue
State
closed
Author
IsaacJT
Labels
Created
Updated
Closed

Current evaluation

A bug report detailing git checkout failures when invoking snapcraft/pack from composite actions was closed without discussion or resolution. No fix was applied.

Suggested action:

No scores available.

Issue body

Using `canonical/craft-actions/snapcraft/pack` inside a composite action fails due to some issues with how git is handled inside the checkout action, resulting in the following error output: ``` Fetching the repository /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --filter=blob:none --depth=1 origin +refs/heads/<branch name>*:refs/remotes/origin/<branch name>* +refs/tags/<branch name>*:refs/tags/<branch name>* The process '/usr/bin/git' failed with exit code 1 Waiting 13 seconds before trying again /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --filter=blob:none --depth=1 origin +refs/heads/<branch name>*:refs/remotes/origin/<branch name>* +refs/tags/<branch name>*:refs/tags/<branch name>* The process '/usr/bin/git' failed with exit code 1 Waiting 10 seconds before trying again /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --filter=blob:none --depth=1 origin +refs/heads/<branch name>*:refs/remotes/origin/<branch name>* +refs/tags/<branch name>*:refs/tags/<branch name>* Error: The process '/usr/bin/git' failed with exit code 1 ``` After this, the job fails. Copilot gave a reasonably convincing analysis of why this is happening: > The failing job "\<build name\>" was failing because `canonical/craft-actions/snapcraft/pack@adff67a3dc8de1b95de1d25728bf83506ab701b2` contains an internal workaround for a known GitHub Actions limitation ([actions/runner#895](https://github.com/actions/runner/issues/895)). > > The workaround works by: > > 1. Setting `env: GITHUB_REF: ${{ github.action_ref }}` on a checkout step > 2. Checking out `canonical/craft-actions` at `ref: ${{ env.GITHUB_REF }}` > > The problem: when `snapcraft/pack` is invoked from within a **composite action in another repository** (our `images/build/action.yml`), `github.action_ref` evaluates to the **outer** composite action's branch ref (`\<branch name\>`) rather than the craft-actions commit SHA. Since the branch `\<branch name\>` doesn't exist in `canonical/craft-actions`, the git fetch fails with exit code 1.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b A bug report detailing git checkout failures when invoking snapcraft/pack from composite actions was closed without discussion or resolution. No fix was applied.
qwen3.6-35b-a3b-mtp-q6
Staleness: 5
Complexity: 35
Confidence: 85
Support Request: 10
needs triage snapcraft/pack GitHub Action fails when used in composite actions due to incorrect GITHUB_REF evaluation causing git fetch to fail. Untriaged, awaiting maintainer review.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2028686 snapcraft pack failure from git worktree snapcraft (launchpad) open snapcraft pack fails when building from a git worktree. Issue is 1136 days old with no labels, no comments, and no maintainer engagement.
71%
#1817907 building part with git source-commit not found in master fails snapcraft (launchpad) closed Closed without resolution due to inactivity. Snapcraft fails to checkout non-master git commits without a prior fetch, leaving the issue abandoned.
71%