Skip to content

Commit 7b8d20f

Browse files
authored
fix(ci): only create local main branch if non-existent (#164)
## Why this should be merged The CI job in #145 requires a local (to the runner) `main` branch and since `actions/checkout` doesn't check it out, the workflow creates the branch off `origin/main`. However, after merge of a PR to `main`, the workflow is run on `main` itself and that step [fails because the branch already exists](https://github.com/ava-labs/libevm/actions/runs/13908218530/job/38916101218). ## How this works Only call `git branch main origin/main` if `main` doesn't exist. ## How this was tested We'll see once it's merged 🤷
1 parent 0ed6135 commit 7b8d20f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ jobs:
5353
uses: actions/setup-go@v5
5454
with:
5555
go-version-file: "./libevm/tooling/go.mod"
56-
- run: git branch main origin/main
56+
- name: Create local `main` if non-existent
57+
run: git show-ref --quiet --verify refs/heads/main || git branch main origin/main
5758
- run: go test -v ./... --target_branch="${{ env.TARGET_BRANCH }}"
5859

5960
go_generate:

0 commit comments

Comments
 (0)