Skip to content

Commit

Permalink
refactor: source commit from workflow input
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR4N committed Oct 11, 2024
1 parent eec97eb commit 5254b44
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/rename-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ on:
pull_request: # DO NOT MERGE WITH ANYTHING OTHER THAN workflow_dispatch
branches: [ main ]
workflow_dispatch:
inputs:
source_commit:
description: 'Upstream commit on which to base module renaming'
required: true
type: string
default: '2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1'

jobs:
rename-module:
runs-on: ubuntu-latest
env:
source_commit: 2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1
output_branch: "${{ github.ref_name }}_auto-rename-module-${{ inputs.source_commit }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # everything
fetch-tags: true

- name: Check out source commit
run: git checkout ${{ env.source_commit }}
run: git checkout ${{ inputs.source_commit }}

- name: Globally update module name
run: |
Expand All @@ -43,24 +49,24 @@ jobs:
# - 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 list . | grep ava-labs/libevm;
go build ./...;
go test ./accounts/abi/bind ./rlp/rlpgen
- name: Commit to "auto-rename-module-${{ env.source_commit }}" branch
- name: Commit to ${{ env.output_branch }} branch
uses: devops-infra/action-commit-push@8bc2ff9f9de7aa2a7581fc7e5b6401c04cab54c7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
target_branch: "auto-rename-module-${{ env.source_commit }}"
target_branch: ${{ env.output_branch }}
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_"
- name: Open PR to "renamed-go-module" iff workflow dispatched on "main"
# if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
uses: devops-infra/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: ${{ env.output_branch }}
target_branch: renamed-go-module
title: "[AUTO] Rename upstream Go module at `${{ inputs.source_commit }}`"
body: "_PR generated by GitHub Action_"

0 comments on commit 5254b44

Please sign in to comment.