ci: clone via GITHUB_REF instead of GITHUB_REF_NAME

In pull_request context, GITHUB_REF_NAME is the PR number ('17'),
not the source branch. Cloning --branch 17 fails with
'Could not find remote branch 17 to clone'.

Use GITHUB_REF (refs/pull/N/head in PR context, refs/heads/<branch>
in push context) and fetch + checkout FETCH_HEAD. workflow_dispatch
falls back to the default branch.
This commit is contained in:
Paul Schneider 2026-08-16 13:22:56 +01:00
commit b168232c5b

View file

@ -43,9 +43,12 @@ jobs:
- name: Clone yavsc - name: Clone yavsc
run: | run: |
cd "$RUNNER_WORKSPACE" cd "$RUNNER_WORKSPACE"
git clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" \ git clone https://forgejo.pschneider.fr/notazof/yavsc.git _src
https://forgejo.pschneider.fr/notazof/yavsc.git _src
cd _src cd _src
if [ -n "${GITHUB_REF:-}" ]; then
git fetch --depth 1 origin "$GITHUB_REF"
git checkout FETCH_HEAD
fi
git submodule update --init --recursive --depth 1 git submodule update --init --recursive --depth 1
- name: Restore dependencies - name: Restore dependencies
working-directory: ${{ runner.workspace }}/_src working-directory: ${{ runner.workspace }}/_src