Skip to content

Commit 0085994

Browse files
fix(workflows): gate gas benchmark workflow for fork PRs (#11684)
Co-authored-by: Carlos Bermudez Porto <43155355+cbermudez97@users.noreply.github.com>
1 parent 1da29fc commit 0085994

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/run-gas-benchmarks.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
env:
5555
EVENT_NAME: ${{ github.event_name }}
5656
LABEL_NAME: ${{ github.event.label.name }}
57+
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
58+
CURRENT_REPO: ${{ github.repository }}
5759
DISPATCH_RUNS: ${{ inputs.runs }}
5860
DISPATCH_TEST_PATH: ${{ inputs.testPath }}
5961
DISPATCH_GENESIS_FILE: ${{ inputs.genesisFile }}
@@ -79,22 +81,26 @@ jobs:
7981
clients="${DISPATCH_CLIENTS:-nethermind}"
8082
filter="${DISPATCH_FILTER:-}"
8183
elif [[ "${EVENT_NAME}" == "pull_request" ]]; then
82-
label="${LABEL_NAME:-}"
84+
if [[ "${PR_HEAD_REPO:-}" != "${CURRENT_REPO:-}" ]]; then
85+
should_run="false"
86+
else
87+
label="${LABEL_NAME:-}"
8388
84-
# Only accept labels in the format: gasbench[-<comma-separated-filters>]
85-
if [[ "${label}" == "gasbench" ]]; then
86-
filter=""
87-
elif [[ "${label}" == gasbench-* ]]; then
88-
suffix="${label#gasbench-}"
89-
if [[ -z "${suffix}" ]]; then
89+
# Only accept labels in the format: gasbench[-<comma-separated-filters>]
90+
if [[ "${label}" == "gasbench" ]]; then
9091
filter=""
91-
elif [[ "${suffix}" =~ ^[A-Za-z0-9_.-]+(,[A-Za-z0-9_.-]+)*$ ]]; then
92-
filter="${suffix}"
92+
elif [[ "${label}" == gasbench-* ]]; then
93+
suffix="${label#gasbench-}"
94+
if [[ -z "${suffix}" ]]; then
95+
filter=""
96+
elif [[ "${suffix}" =~ ^[A-Za-z0-9_.-]+(,[A-Za-z0-9_.-]+)*$ ]]; then
97+
filter="${suffix}"
98+
else
99+
should_run="false"
100+
fi
93101
else
94102
should_run="false"
95103
fi
96-
else
97-
should_run="false"
98104
fi
99105
fi
100106

0 commit comments

Comments
 (0)