Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GitHub action to rename module #51

Merged
merged 19 commits into from
Oct 11, 2024
Merged

feat: GitHub action to rename module #51

merged 19 commits into from
Oct 11, 2024

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Oct 8, 2024

Why this should be merged

Automate renaming of the Go module from github.com/ethereum/go-ethereum to github.com/ava-labs/libevm.

How this works

Before starting this PR, I branched the renamed-go-module branch off master (the upstream geth branch; our default is called main). It has been protected to require PRs, which are automatically generated by the workflow introduced in this PR.

The new workflow is designed to be manually dispatched with an input string of the commit hash to use as a source for renaming. On dispatch, it:

  1. Checks out the source commit;
  2. Renames the module;
  3. Makes all necessary internal changes (e.g. import renaming);
  4. Runs smoke tests;
  5. Commits the changes to a new branch; and
  6. Opens a PR to merge the new branch into renamed-go-module.

Intended usage

When performing an upstream sync to pull in new geth code, this workflow will first be run against the geth commit we intend to merge. After the generated PR is merged, the renamed-go-module branch will be the one incorporated into main.

Note that the renamed-go-module branch requires two reviewers to approve. The user who dispatches the workflow SHOULD be one, with any other valid reviewer as the other. This is because a single-reviewer workflow would allow any user to update the renamed-go-module branch because the PR author is github-actions.

How this was tested

Inspection of the generated PR #57 as well as the workflow run that generated it.

@ARR4N ARR4N requested review from a team, darioush, ceyonur and michaelkaplan13 and removed request for a team October 11, 2024 20:10
@ARR4N ARR4N marked this pull request as ready for review October 11, 2024 20:13
@ARR4N ARR4N enabled auto-merge (squash) October 11, 2024 20:17
description: 'Upstream commit on which to base module renaming'
required: true
type: string
default: '2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use a tag or a commit here?

@ARR4N ARR4N merged commit a8cc7bd into main Oct 11, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/rename-go-mod-auto branch October 11, 2024 20:30
ARR4N added a commit that referenced this pull request Oct 11, 2024
## Why this should be merged

#51 had a bug when checking whether or not to open a PR. I was
originally blocking everything if _not_ on main instead of doing
something if on it. The [manually dispatched run therefore didn't open a
PR as
expected](https://github.com/ava-labs/libevm/actions/runs/11299366394/job/31430160561).

## How this works

Change `!=` to `==`

## How this was tested

n/a

Signed-off-by: Arran Schlosberg <[email protected]>
ARR4N added a commit that referenced this pull request Oct 17, 2024
## Why this should be merged

Signs commits for auto-renaming the Go module, originally introduced in
#51 with unsigned commits that can't be merged to `main`.

## How this works

Changes the commit action to use
[`ghcommit`](https://github.com/planetscale/ghcommit), which was made
specifically to allow for keyless signing (GitHub signs the commit). The
workflow no longer opens a PR to the `renamed-go-module` branch as it's
redundant and the generated branch can be used directly.

The commit message includes the `workflow_dispatch` trigger branch as
well as a hash of the workflow file for a complete audit trail.

I removed the commented-out PR trigger as it's unnecessary. In
development we can now just trigger the workflow on the dev branch.

## How this was tested

Inspecting [the
commit](572b8ab)
generated by a [workflow
run](https://github.com/ava-labs/libevm/actions/runs/11357025696/job/31589219847).
It is identical in modifications to the one reviewed in #59.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants