Skip to content

feat: GitHub action to rename module #10

feat: GitHub action to rename module

feat: GitHub action to rename module #10

Workflow file for this run

name: Rename Go module
on:
pull_request: # DO NOT MERGE WITH ANYTHING OTHER THAN workflow_dispatch
branches: [ main ]
workflow_dispatch:
jobs:
rename-module:
runs-on: ubuntu-latest
env:
source_commit: 2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # everything
fetch-tags: true
- name: Check out source commit
run: git checkout ${{ env.source_commit }}
- name: Globally update module name
run: |
go mod edit -module github.com/ava-labs/libevm;
find . -iname '*.go' -o -iname '*.txt' | xargs sed -i -E \
's|(["`]github\.com/)ethereum/go-ethereum|\1ava-labs/libevm|g';
- name: Remnant references
run: |
find . -type f | \
xargs grep -In github.com/ethereum/go-ethereum | \
grep -v "https://github.com/ethereum/go-ethereum"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.4
- name: Smoke tests
# `go list` shows us the module name
# `go build` is a rudimentary but broad test of correctness
# The explicitly tested packages are edge cases:
# - bind creates generates tests and a go.mod on the fly
# - rlpgen has testdata with imports that need updating
run: |
go list . | grep ava-labs;
go build ./...;
go test ./accounts/abi/bind ./rlp/rlpgen
- name: Commit to "auto-rename-module-${{ env.source_commit }}" branch
uses: devops-infra/action-commit-push@8bc2ff9f9de7aa2a7581fc7e5b6401c04cab54c7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
target_branch: "auto-rename-module-${{ env.source_commit }}"
force: true
commit_prefix: "[AUTO] rename Go module + update internal import paths"
# DO NOT MERGE without re-enabling this.
# - name: Open PR to "renamed-go-module"
# uses: devops-infra/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# source_branch: "auto-rename-module-${{ env.source_commit }}"
# target_branch: renamed-go-module
# title: "[AUTO] Rename upstream Go module at `${{ env.source_commit }}`"
# body: "_PR generated by GitHub Action_"