Skip to content

Commit 3975d16

Browse files
authored
feat(ci): update inputs for ci rebase/merge workflows (ethereum#2072)
* feat(ci): update inputs for ci rebase/merge workflows * feat(ci): address review feedback for rebase action * fix(ci): run static checks on each rebased eip branch
1 parent ae78d8a commit 3975d16

4 files changed

Lines changed: 72 additions & 39 deletions

File tree

.github/actions/merge-eip-branches/action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
description: 'Devnet name (e.g., amsterdam/1, bal/2, eip-1234/3). Created branch will be `devnets/$devnet_name`'
1010
required: true
1111
eip_numbers:
12-
description: 'Comma-separated list of EIP numbers (e.g., 1234,2345,3456)'
12+
description: 'List of EIP numbers (e.g., 1234,2345+3456 for eip-1234 and combined eip-2345+3456)'
1313
required: true
1414

1515
runs:
@@ -50,8 +50,8 @@ runs:
5050
for raw in "${RAW_EIPS[@]}"; do
5151
eip="$(echo "$raw" | xargs)" # trims leading/trailing whitespace
5252
if [[ -n "$eip" ]]; then
53-
# Optional: ensure it looks numeric
54-
if [[ ! "$eip" =~ ^[0-9]+$ ]]; then
53+
# Ensure it looks like EIP number(s) - digits optionally joined by +
54+
if [[ ! "$eip" =~ ^[0-9]+(\+[0-9]+)*$ ]]; then
5555
echo "Error: Invalid EIP number ${eip}"
5656
exit 1
5757
fi
Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Rebase EIP Branch
2-
description: Rebases an EIP branch onto a fork branch
1+
name: Rebase EIP Branches
2+
description: Rebases EIP branches onto a fork branch
33
inputs:
44
fork:
55
description: 'Fork name (e.g., amsterdam)'
66
required: true
7-
eip_number:
8-
description: 'EIP number'
7+
default: 'amsterdam'
8+
eip_numbers:
9+
description: 'List of EIP numbers (e.g., 1234,2345+3456 for eip-1234 and combined eip-2345+3456)'
910
required: true
1011
runs:
1112
using: "composite"
@@ -16,18 +17,17 @@ runs:
1617
git config user.name "github-actions[bot]"
1718
git config user.email "github-actions[bot]@users.noreply.github.com"
1819
19-
- name: Rebase EIP branch (create if missing)
20+
- name: Rebase EIP branches (create if missing)
2021
shell: bash
2122
env:
2223
FORK: ${{ inputs.fork }}
23-
EIP_NUMBER: ${{ inputs.eip_number }}
24+
EIP_NUMBERS: ${{ inputs.eip_numbers }}
2425
REMOTE: origin
2526
run: |
2627
set -euo pipefail
2728
2829
echo "FORK=$FORK"
29-
echo "EIP_NUMBER=$EIP_NUMBER"
30-
EIP_BRANCH="eips/${FORK}/eip-${EIP_NUMBER}"
30+
echo "EIP_NUMBERS=$EIP_NUMBERS"
3131
FORK_BRANCH="forks/${FORK}"
3232
3333
git fetch "${REMOTE}" --prune
@@ -38,37 +38,69 @@ runs:
3838
exit 1
3939
fi
4040
41-
# Create local branch from remote if it exists, else create from fork base
42-
if git show-ref --verify --quiet "refs/remotes/${REMOTE}/${EIP_BRANCH}"; then
43-
echo "Checking out existing ${EIP_BRANCH} (tracking ${REMOTE})"
44-
git checkout -B "${EIP_BRANCH}" "${REMOTE}/${EIP_BRANCH}"
45-
else
46-
echo "Branch ${EIP_BRANCH} does not exist on ${REMOTE}; creating from ${REMOTE}/${FORK_BRANCH}"
47-
git checkout -B "${EIP_BRANCH}" "${REMOTE}/${FORK_BRANCH}"
41+
# Convert comma-separated list to array
42+
IFS=',' read -ra RAW_EIPS <<< "$EIP_NUMBERS"
4843
49-
# First push creates the remote branch (no force needed)
50-
git push -u "${REMOTE}" "${EIP_BRANCH}"
51-
fi
44+
# Normalize: trim whitespace, drop empties, validate
45+
EIPS=()
46+
for raw in "${RAW_EIPS[@]}"; do
47+
eip="$(echo "$raw" | xargs)" # trims leading/trailing whitespace
48+
if [[ -n "$eip" ]]; then
49+
# Ensure it looks like EIP number(s) - digits optionally joined by +
50+
if [[ ! "$eip" =~ ^[0-9]+(\+[0-9]+)*$ ]]; then
51+
echo "Error: Invalid EIP number ${eip}"
52+
exit 1
53+
fi
54+
EIPS+=("$eip")
55+
fi
56+
done
5257
53-
echo "Rebasing ${EIP_BRANCH} onto ${REMOTE}/${FORK_BRANCH}"
54-
if ! git rebase "${REMOTE}/${FORK_BRANCH}"; then
55-
echo "Error: Rebase conflict occurred while rebasing ${EIP_BRANCH} onto ${FORK_BRANCH}"
56-
git rebase --abort || true
58+
if [[ ${#EIPS[@]} -eq 0 ]]; then
59+
echo "Error: No EIP numbers provided after parsing '${EIP_NUMBERS}'"
5760
exit 1
5861
fi
5962
60-
echo "Running static checks on rebased branch"
61-
uvx --with=tox-uv tox -e static
63+
for EIP_NUMBER in "${EIPS[@]}"; do
64+
EIP_BRANCH="eips/${FORK}/eip-${EIP_NUMBER}"
65+
66+
# Create local branch from remote if it exists, else create from fork base
67+
if git show-ref --verify --quiet "refs/remotes/${REMOTE}/${EIP_BRANCH}"; then
68+
echo "Checking out existing ${EIP_BRANCH} (tracking ${REMOTE})"
69+
git checkout -B "${EIP_BRANCH}" "${REMOTE}/${EIP_BRANCH}"
70+
else
71+
echo "Branch ${EIP_BRANCH} does not exist on ${REMOTE}; creating from ${REMOTE}/${FORK_BRANCH}"
72+
git checkout -B "${EIP_BRANCH}" "${REMOTE}/${FORK_BRANCH}"
73+
74+
# First push creates the remote branch (no force needed)
75+
git push -u "${REMOTE}" "${EIP_BRANCH}"
76+
fi
77+
78+
echo "Rebasing ${EIP_BRANCH} onto ${REMOTE}/${FORK_BRANCH}"
79+
if ! git rebase "${REMOTE}/${FORK_BRANCH}"; then
80+
echo "Error: Rebase conflict occurred while rebasing ${EIP_BRANCH} onto ${FORK_BRANCH}"
81+
git rebase --abort || true
82+
exit 1
83+
fi
84+
85+
echo "Rebase of ${EIP_BRANCH} successful"
6286
63-
echo "Rebase successful"
87+
echo "Running static checks on ${EIP_BRANCH}"
88+
uvx --with=tox-uv tox -e static
89+
done
6490
65-
- name: Push rebased branch
91+
- name: Push rebased branches
6692
shell: bash
6793
env:
6894
FORK: ${{ inputs.fork }}
69-
EIP_NUMBER: ${{ inputs.eip_number }}
95+
EIP_NUMBERS: ${{ inputs.eip_numbers }}
7096
REMOTE: origin
7197
run: |
72-
EIP_BRANCH="eips/${FORK}/eip-${EIP_NUMBER}"
73-
echo "Force pushing ${EIP_BRANCH} to ${REMOTE}"
74-
git push --force-with-lease "${REMOTE}" "${EIP_BRANCH}"
98+
IFS=',' read -ra RAW_EIPS <<< "$EIP_NUMBERS"
99+
for raw in "${RAW_EIPS[@]}"; do
100+
eip="$(echo "$raw" | xargs)"
101+
if [[ -n "$eip" ]]; then
102+
EIP_BRANCH="eips/${FORK}/eip-${eip}"
103+
echo "Force pushing ${EIP_BRANCH} to ${REMOTE}"
104+
git push --force-with-lease "${REMOTE}" "${EIP_BRANCH}"
105+
fi
106+
done

.github/workflows/eip-rebase.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on:
77
description: 'Fork name (e.g., amsterdam)'
88
required: true
99
type: string
10-
eip_number:
11-
description: 'EIP number'
10+
default: 'amsterdam'
11+
eip_numbers:
12+
description: 'List of EIP numbers (e.g., 1234,2345+3456 for eip-1234 and combined eip-2345+3456)'
1213
required: true
1314
type: string
1415

1516
concurrency:
16-
group: ${{ github.workflow }}-${{ github.event.inputs.fork }}-${{ github.event.inputs.eip_number }}
17+
group: ${{ github.workflow }}-${{ github.event.inputs.fork }}-${{ github.event.inputs.eip_numbers }}
1718
cancel-in-progress: false
1819

1920
permissions:
@@ -32,8 +33,8 @@ jobs:
3233
- name: Setup uv
3334
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
3435

35-
- name: Rebase EIP branch onto fork
36+
- name: Rebase EIP branches onto fork
3637
uses: ./.github/actions/rebase-eip-branch
3738
with:
3839
fork: ${{ github.event.inputs.fork }}
39-
eip_number: ${{ github.event.inputs.eip_number }}
40+
eip_numbers: ${{ github.event.inputs.eip_numbers }}

.github/workflows/update-devnet-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
type: string
1515
default: 'bal/2'
1616
eip_numbers:
17-
description: 'Comma-separated list of EIP numbers (e.g., 1234,2345,3456)'
17+
description: 'List of EIP numbers (e.g., 1234,2345+3456 for eip-1234 and combined eip-2345+3456)'
1818
required: true
1919
type: string
2020
default: '8024,7843,7708,7778'

0 commit comments

Comments
 (0)