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 🤷
This commit is contained in:
Arran Schlosberg 2025-03-17 20:00:39 +00:00 committed by GitHub
parent 0ed61356ed
commit 7b8d20f3d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,7 +53,8 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: "./libevm/tooling/go.mod"
- run: git branch main origin/main
- name: Create local `main` if non-existent
run: git show-ref --quiet --verify refs/heads/main || git branch main origin/main
- run: go test -v ./... --target_branch="${{ env.TARGET_BRANCH }}"
go_generate: