This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 3f43c2141bb1 ci: pass the PR number through env in pr-build-main, not
into run text (#31076)
3f43c2141bb1 is described below
commit 3f43c2141bb1f0761c73d7dba37fa3fa9115057c
Author: dhairya05 <[email protected]>
AuthorDate: Mon Nov 30 14:03:08 2026 +0530
ci: pass the PR number through env in pr-build-main, not into run text
(#31076)
Follow-up to the same defect class in the main PR build. Two run: blocks
expand ${{ github.event.number || inputs.pr_number }} directly, and GitHub
substitutes ${{ }} textually before bash parses the script, so the value
arrives as script rather than as data.
github.event.number is an integer and harmless; inputs.pr_number is a
free-text workflow_dispatch input, so that is the one that matters. It needs
write access to exercise, so this is hardening, not an open hole.
The file already uses the right pattern one step down -- the second of the
two
steps has an env: block for RUN_URL -- so the first step gains an env: block
and the second gets one more entry.
The || fallback still works: GitHub evaluates it when building the env:
value
just as it did when building the script text.
zizmor goes from 2 high template-injection findings on this file to none;
actionlint reports the same 7 findings before and after.
Co-Authored-By: Claude <[email protected]>
---
.github/workflows/pr-build-main.yml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pr-build-main.yml
b/.github/workflows/pr-build-main.yml
index badc085cc239..5fa58244bf53 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -146,6 +146,8 @@ jobs:
- name: Fail if there are uncommitted changes
if: ${{ !inputs.skip_full_build }}
shell: bash
+ env:
+ PR_NUMBER: ${{ github.event.number || inputs.pr_number }}
run: |
if [[ -z $(git status --porcelain) ]]; then
exit 0
@@ -162,7 +164,7 @@ jobs:
git add -A
mkdir -p regen-patch-artifact
git diff --cached --binary > regen-patch-artifact/regen.patch
- echo "${{ github.event.number || inputs.pr_number }}" >
regen-patch-artifact/pr-number
+ echo "$PR_NUMBER" > regen-patch-artifact/pr-number
exit 1
# Both non-experimental matrix entries regenerate the same files, so the
# patch content is identical across JDKs — last writer wins, same as the
@@ -217,9 +219,10 @@ jobs:
shell: bash
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository
}}/actions/runs/${{ github.run_id }}
+ PR_NUMBER: ${{ github.event.number || inputs.pr_number }}
run: |
mkdir -p ci-comment-artifact
- prNumber="${{ github.event.number || inputs.pr_number }}"
+ prNumber="$PR_NUMBER"
echo "$prNumber" > ci-comment-artifact/pr-number
if [ -f incremental-test-comment.md ]; then
cp incremental-test-comment.md ci-comment-artifact/