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:
parent
380b5d12c8
commit
7370f48aac
1 changed files with 5 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue