Skip to content

Commit cb09ce3

Browse files
skylenetfselmo
andauthored
chore: fixing CI for PRs from forks (#237)
## Summary Cherry-picked from the second commit of #182 (`4439298`, by @fselmo). Adds a `git-repo` input to the composite action so CI workflows triggered by PRs from forks clone the fork's HEAD instead of always cloning `ethpandaops/benchmarkoor`. The workflow wires `github.event.pull_request.head.repo.clone_url` into that input and uses `head.repo.full_name` in the `run-config-urls` so the runtime config files are also fetched from the fork. ## Test plan - [ ] Open a PR from a fork against this branch and confirm the CI action clones the fork (the workflow log should show `Cloning https://github.com/<fork-owner>/benchmarkoor.git at ref <sha>`). - [ ] Verify the `run-config-urls` resolve to `raw.githubusercontent.com/<fork-owner>/benchmarkoor/<sha>/...` rather than the canonical repo path. - [ ] PRs from branches inside `ethpandaops/benchmarkoor` should continue to clone the canonical repo unchanged. Co-authored-by: Felipe Selmo <fselmo2@gmail.com>
1 parent 1e405e3 commit cb09ce3

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

.github/workflows/ci.action.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ jobs:
2020
with:
2121
github-token: ${{ secrets.GITHUB_TOKEN }}
2222
git-ref: ${{ github.event.pull_request.head.sha }}
23+
git-repo: ${{ github.event.pull_request.head.repo.clone_url }}
2324
#run-args: '--log-level=debug'
2425
run-config-urls: >-
25-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
26-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
26+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
27+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
2728
run-config: |
2829
runner:
2930
benchmark:
@@ -62,10 +63,11 @@ jobs:
6263
with:
6364
github-token: ${{ secrets.GITHUB_TOKEN }}
6465
git-ref: ${{ github.event.pull_request.head.sha }}
66+
git-repo: ${{ github.event.pull_request.head.repo.clone_url }}
6567
#run-args: '--log-level=debug'
6668
run-config-urls: >-
67-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
68-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
69+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
70+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
6971
run-config: |
7072
runner:
7173
container_runtime: podman
@@ -102,10 +104,11 @@ jobs:
102104
with:
103105
github-token: ${{ secrets.GITHUB_TOKEN }}
104106
git-ref: ${{ github.event.pull_request.head.sha }}
107+
git-repo: ${{ github.event.pull_request.head.repo.clone_url }}
105108
#run-args: '--log-level=debug'
106109
run-config-urls: >-
107-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
108-
https://raw.githubusercontent.com/ethpandaops/benchmarkoor/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
110+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-cleanup.yaml,
111+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }}/.github/workflows/config/benchmarkoor-global-clientstdout.yaml
109112
run-config: |
110113
runner:
111114
container_runtime: podman

action.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ inputs:
2020
required: false
2121
default: ''
2222

23+
git-repo:
24+
description: 'Git repository URL to clone for building the image. Only used when image is not provided. Defaults to ethpandaops/benchmarkoor.'
25+
required: false
26+
default: 'https://github.com/ethpandaops/benchmarkoor.git'
27+
2328
upload-artifacts:
2429
description: 'Whether to upload run results as GitHub artifacts'
2530
required: false
@@ -65,8 +70,10 @@ runs:
6570
GIT_REF="master"
6671
fi
6772
68-
echo "Cloning https://github.com/ethpandaops/benchmarkoor.git at ref $GIT_REF"
69-
git clone https://github.com/ethpandaops/benchmarkoor.git benchmarkoor-build
73+
GIT_REPO="${{ inputs.git-repo }}"
74+
75+
echo "Cloning ${GIT_REPO} at ref $GIT_REF"
76+
git clone "${GIT_REPO}" benchmarkoor-build
7077
cd benchmarkoor-build
7178
git checkout "$GIT_REF"
7279

0 commit comments

Comments
 (0)