Skip to content

Commit 61a2926

Browse files
fix(ci): composite action cannot read github/secrets/job — caller passes them as inputs
The nr-ci-event composite action referenced github.*/secrets.*/job.status in its own env: block; GitHub rejects those inside a composite action. Move resolution to the caller's with: block; action reads only inputs.*. Adds event-name + actor inputs; callers pass repo/workflow/branch/commit-sha/log-url/event-name/actor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3af24a7 commit 61a2926

4 files changed

Lines changed: 59 additions & 17 deletions

File tree

.github/actions/nr-ci-event/action.yml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,28 @@ inputs:
4545
Logical suite name, e.g. build-and-test, coverage, playwright, pr-smoke,
4646
e2e-prod, deploy-gate. The dashboard FACETs on this.
4747
required: true
48+
# NOTE: composite actions cannot read the `github` context in their own
49+
# expressions, so the caller MUST pass these from its `with:` block (e.g.
50+
# repo: ${{ github.repository }}). The defaults below only apply when a caller
51+
# omits them entirely.
4852
repo:
49-
description: 'Repository (owner/name). Default ${{ github.repository }}.'
53+
description: 'Repository (owner/name). Caller passes ${{ github.repository }}.'
5054
required: false
5155
default: ''
5256
workflow:
53-
description: 'Workflow name. Default ${{ github.workflow }}.'
57+
description: 'Workflow name. Caller passes ${{ github.workflow }}.'
5458
required: false
5559
default: ''
5660
branch:
57-
description: 'Branch ref name. Default ${{ github.ref_name }}.'
61+
description: 'Branch ref name. Caller passes ${{ github.ref_name }}.'
5862
required: false
5963
default: ''
6064
commit-sha:
61-
description: 'Commit SHA under test. Default ${{ github.sha }}.'
65+
description: 'Commit SHA under test. Caller passes ${{ github.sha }}.'
6266
required: false
6367
default: ''
6468
pr-number:
65-
description: 'PR number (empty on push). Default ${{ github.event.pull_request.number }}.'
69+
description: 'PR number (empty on push). Caller passes ${{ github.event.pull_request.number }}.'
6670
required: false
6771
default: ''
6872
duration-ms:
@@ -74,8 +78,15 @@ inputs:
7478
required: false
7579
default: ''
7680
log-url:
77-
description: >-
78-
URL to the run logs for triage. Default the run's GitHub Actions URL.
81+
description: 'URL to the run logs for triage. Caller passes the run URL.'
82+
required: false
83+
default: ''
84+
event-name:
85+
description: 'GitHub event name. Caller passes ${{ github.event_name }}.'
86+
required: false
87+
default: ''
88+
actor:
89+
description: 'GitHub actor. Caller passes ${{ github.actor }}.'
7990
required: false
8091
default: ''
8192

@@ -85,24 +96,27 @@ runs:
8596
- name: Emit CI result to New Relic (no-op without secret)
8697
shell: bash
8798
env:
88-
# All untrusted/free-form values flow through env, never interpolated
89-
# into the shell body — same injection-safe posture as ci.yml's
90-
# dispatch-auth-contract-e2e job.
99+
# Composite actions may reference ONLY `inputs` (+ env/runner/steps) in
100+
# their expressions — `secrets`, `job`, and `github` are NOT available
101+
# here, so the CALLER resolves those and passes them as inputs. All
102+
# untrusted/free-form values flow through env, never interpolated into
103+
# the shell body (injection-safe — same posture as ci.yml's
104+
# dispatch-auth-contract-e2e job).
91105
NR_LICENSE_KEY: ${{ inputs.license-key }}
92106
NR_ACCOUNT_ID: ${{ inputs.account-id }}
93107
NR_REGION: ${{ inputs.nr-region }}
94108
EV_RESULT: ${{ inputs.result }}
95109
EV_SUITE: ${{ inputs.suite }}
96-
EV_REPO: ${{ inputs.repo != '' && inputs.repo || github.repository }}
97-
EV_WORKFLOW: ${{ inputs.workflow != '' && inputs.workflow || github.workflow }}
98-
EV_BRANCH: ${{ inputs.branch != '' && inputs.branch || github.ref_name }}
99-
EV_COMMIT: ${{ inputs.commit-sha != '' && inputs.commit-sha || github.sha }}
110+
EV_REPO: ${{ inputs.repo }}
111+
EV_WORKFLOW: ${{ inputs.workflow }}
112+
EV_BRANCH: ${{ inputs.branch }}
113+
EV_COMMIT: ${{ inputs.commit-sha }}
100114
EV_PR: ${{ inputs.pr-number }}
101115
EV_DURATION_MS: ${{ inputs.duration-ms }}
102116
EV_FAILED_STEP: ${{ inputs.failed-step }}
103-
EV_LOG_URL: ${{ inputs.log-url != '' && inputs.log-url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
104-
EV_EVENT_NAME: ${{ github.event_name }}
105-
EV_ACTOR: ${{ github.actor }}
117+
EV_LOG_URL: ${{ inputs.log-url }}
118+
EV_EVENT_NAME: ${{ inputs.event-name }}
119+
EV_ACTOR: ${{ inputs.actor }}
106120
run: |
107121
set -uo pipefail
108122

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ jobs:
6969
suite: build-and-test
7070
pr-number: ${{ github.event.pull_request.number }}
7171
failed-step: ${{ job.status != 'success' && 'gen:api-types:check / build (tsc+vite+prerender) / vitest' || '' }}
72+
repo: ${{ github.repository }}
73+
workflow: ${{ github.workflow }}
74+
branch: ${{ github.ref_name }}
75+
commit-sha: ${{ github.sha }}
76+
log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
77+
event-name: ${{ github.event_name }}
78+
actor: ${{ github.actor }}
7279

7380
playwright:
7481
runs-on: ubuntu-latest
@@ -97,3 +104,10 @@ jobs:
97104
suite: playwright
98105
pr-number: ${{ github.event.pull_request.number }}
99106
failed-step: ${{ job.status != 'success' && 'playwright (mocked, chromium)' || '' }}
107+
repo: ${{ github.repository }}
108+
workflow: ${{ github.workflow }}
109+
branch: ${{ github.ref_name }}
110+
commit-sha: ${{ github.sha }}
111+
log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
112+
event-name: ${{ github.event_name }}
113+
actor: ${{ github.actor }}

.github/workflows/e2e-pr-smoke.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,10 @@ jobs:
191191
suite: pr-smoke
192192
pr-number: ${{ github.event.pull_request.number }}
193193
failed-step: ${{ job.status != 'success' && 'real-backend UI @pr-smoke journeys / mint / reap' || '' }}
194+
repo: ${{ github.repository }}
195+
workflow: ${{ github.workflow }}
196+
branch: ${{ github.ref_name }}
197+
commit-sha: ${{ github.sha }}
198+
log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
199+
event-name: ${{ github.event_name }}
200+
actor: ${{ github.actor }}

.github/workflows/e2e-prod.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,10 @@ jobs:
212212
result: ${{ job.status == 'success' && 'pass' || 'fail' }}
213213
suite: e2e-prod
214214
failed-step: ${{ job.status != 'success' && 'live-prod E2E journeys / mint / reap' || '' }}
215+
repo: ${{ github.repository }}
216+
workflow: ${{ github.workflow }}
217+
branch: ${{ github.ref_name }}
218+
commit-sha: ${{ github.sha }}
219+
log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
220+
event-name: ${{ github.event_name }}
221+
actor: ${{ github.actor }}

0 commit comments

Comments
 (0)