@htekdev/actions-debugger 1.0.113 → 1.0.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/errors/caching-artifacts/cache-corrupt-on-cancel-during-restore-save-always.yml +136 -0
- package/errors/caching-artifacts/restore-keys-asterisk-literal-not-glob.yml +107 -0
- package/errors/concurrency-timing/pull-request-review-shared-concurrency-cancels-ci.yml +131 -0
- package/errors/known-unsolved/github-script-esm-not-supported.yml +111 -0
- package/errors/known-unsolved/job-outputs-string-only-no-array-object.yml +142 -0
- package/errors/permissions-auth/oidc-immutable-sub-claim-new-repo-trust-policy-mismatch.yml +122 -0
- package/errors/permissions-auth/permissions-auth-064.yml +122 -0
- package/errors/permissions-auth/permissions-auth-065.yml +97 -0
- package/errors/permissions-auth/permissions-auth-066.yml +129 -0
- package/errors/runner-environment/arc-kubernetes-checkout-circular-json-container-hook.yml +101 -0
- package/errors/runner-environment/cache-restore-windows-runner-silent-crash.yml +130 -0
- package/errors/runner-environment/git-248-fetch-tags-shallow-clone-regression.yml +100 -0
- package/errors/runner-environment/javascript-actions-alpine-arm64-not-supported.yml +121 -0
- package/errors/runner-environment/runner-environment-188.yml +96 -0
- package/errors/runner-environment/runner-environment-191.yml +147 -0
- package/errors/runner-environment/runner-environment-192.yml +144 -0
- package/errors/runner-environment/runner-environment-193.yml +136 -0
- package/errors/runner-environment/runner-environment-194.yml +86 -0
- package/errors/silent-failures/checkout-v6-clean-false-deletes-workspace-on-repo-change.yml +119 -0
- package/errors/silent-failures/queue-max-silently-ignored-with-cancel-in-progress.yml +109 -0
- package/errors/silent-failures/silent-failures-102.yml +141 -0
- package/errors/silent-failures/silent-failures-104.yml +119 -0
- package/errors/yaml-syntax/yaml-syntax-068.yml +137 -0
- package/errors/yaml-syntax/yaml-syntax-069.yml +118 -0
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
id: silent-failures-102
|
|
2
|
+
title: 'Matrix include: Property Boolean Values Coerced to Strings — Conditional Jobs Silently Misbehave'
|
|
3
|
+
category: silent-failures
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- matrix
|
|
7
|
+
- include
|
|
8
|
+
- boolean
|
|
9
|
+
- string-coercion
|
|
10
|
+
- if-condition
|
|
11
|
+
- fromJSON
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: 'matrix\.[a-z_]+\s*==\s*(?:true|false)\b'
|
|
14
|
+
flags: 'i'
|
|
15
|
+
- regex: 'if:\s*\$\{\{\s*matrix\.[a-z_]+\s*\}\}'
|
|
16
|
+
flags: 'i'
|
|
17
|
+
error_messages:
|
|
18
|
+
- "if: ${{ matrix.enabled }}"
|
|
19
|
+
- "if: ${{ matrix.enabled == false }}"
|
|
20
|
+
- "if: ${{ matrix.deploy == true }}"
|
|
21
|
+
root_cause: |
|
|
22
|
+
All matrix property values — including those injected via `include:` entries — are coerced to
|
|
23
|
+
**strings** before expression evaluation at runtime. A matrix property configured as:
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
strategy:
|
|
27
|
+
matrix:
|
|
28
|
+
include:
|
|
29
|
+
- os: ubuntu-latest
|
|
30
|
+
enabled: false
|
|
31
|
+
- os: windows-latest
|
|
32
|
+
enabled: true
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
produces `matrix.enabled` equal to the string `"false"` or `"true"`, not the boolean
|
|
36
|
+
`false` / `true`. This creates two distinct silent failure modes:
|
|
37
|
+
|
|
38
|
+
1. `if: ${{ matrix.enabled }}` — the string `"false"` is **truthy** in GitHub Actions expression
|
|
39
|
+
syntax (non-empty string = true). The job/step **always runs** even when the intent is to skip
|
|
40
|
+
entries where `enabled: false`.
|
|
41
|
+
|
|
42
|
+
2. `if: ${{ matrix.enabled == false }}` — compares a string against a boolean. In GitHub
|
|
43
|
+
Actions expression syntax, `"false" == false` evaluates to `false` (type mismatch). The
|
|
44
|
+
condition **always evaluates to false**, silently skipping every include entry regardless
|
|
45
|
+
of the configured value.
|
|
46
|
+
|
|
47
|
+
In both cases the workflow completes without errors or warnings. Only the observable runtime
|
|
48
|
+
behavior is wrong: jobs that should be skipped always run, or jobs that should run are
|
|
49
|
+
silently skipped.
|
|
50
|
+
|
|
51
|
+
This is distinct from composite action boolean input coercion (silent-failures-004), which
|
|
52
|
+
covers `inputs.*` properties. Matrix properties have no `type:` annotation — they are always
|
|
53
|
+
strings at expression evaluation time.
|
|
54
|
+
fix: |
|
|
55
|
+
Use `fromJSON()` to parse the matrix property string into a native boolean before comparison:
|
|
56
|
+
|
|
57
|
+
- `if: ${{ fromJSON(matrix.enabled) }}` ✅ — `fromJSON("false")` → boolean `false` (falsy), skips correctly
|
|
58
|
+
- `if: ${{ fromJSON(matrix.enabled) == false }}` ✅ — correct boolean comparison
|
|
59
|
+
- `if: ${{ matrix.enabled }}` ❌ — string `"false"` is truthy, job always runs
|
|
60
|
+
- `if: ${{ matrix.enabled == false }}` ❌ — string vs boolean comparison, always evaluates to false
|
|
61
|
+
|
|
62
|
+
The same `fromJSON()` pattern applies to steps inside the matrix job:
|
|
63
|
+
```yaml
|
|
64
|
+
steps:
|
|
65
|
+
- name: Deploy step
|
|
66
|
+
if: ${{ fromJSON(matrix.deploy) }}
|
|
67
|
+
run: ./deploy.sh
|
|
68
|
+
```
|
|
69
|
+
fix_code:
|
|
70
|
+
- language: yaml
|
|
71
|
+
label: 'Correct: fromJSON() converts string to native boolean'
|
|
72
|
+
code: |
|
|
73
|
+
jobs:
|
|
74
|
+
build:
|
|
75
|
+
strategy:
|
|
76
|
+
matrix:
|
|
77
|
+
include:
|
|
78
|
+
- os: ubuntu-latest
|
|
79
|
+
enabled: true
|
|
80
|
+
deploy: false
|
|
81
|
+
- os: windows-latest
|
|
82
|
+
enabled: false
|
|
83
|
+
deploy: false
|
|
84
|
+
runs-on: ${{ matrix.os }}
|
|
85
|
+
# ✅ Correct: fromJSON() parses "false" → boolean false (falsy)
|
|
86
|
+
if: ${{ fromJSON(matrix.enabled) }}
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v4
|
|
89
|
+
|
|
90
|
+
- name: Deploy (conditional step)
|
|
91
|
+
# ✅ Correct: fromJSON() for step-level boolean matrix property
|
|
92
|
+
if: ${{ fromJSON(matrix.deploy) }}
|
|
93
|
+
run: echo "Deploying on ${{ matrix.os }}"
|
|
94
|
+
|
|
95
|
+
- language: yaml
|
|
96
|
+
label: 'Wrong: string "false" is truthy — job always runs'
|
|
97
|
+
code: |
|
|
98
|
+
jobs:
|
|
99
|
+
build:
|
|
100
|
+
strategy:
|
|
101
|
+
matrix:
|
|
102
|
+
include:
|
|
103
|
+
- os: ubuntu-latest
|
|
104
|
+
enabled: true
|
|
105
|
+
- os: windows-latest
|
|
106
|
+
enabled: false
|
|
107
|
+
runs-on: ${{ matrix.os }}
|
|
108
|
+
# ❌ Wrong: matrix.enabled is the string "false", which is truthy
|
|
109
|
+
if: ${{ matrix.enabled }}
|
|
110
|
+
steps:
|
|
111
|
+
- run: echo "This always runs even when enabled: false"
|
|
112
|
+
|
|
113
|
+
- language: yaml
|
|
114
|
+
label: 'Wrong: string vs boolean comparison always false'
|
|
115
|
+
code: |
|
|
116
|
+
jobs:
|
|
117
|
+
build:
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
strategy:
|
|
120
|
+
matrix:
|
|
121
|
+
include:
|
|
122
|
+
- name: job-a
|
|
123
|
+
skip: false
|
|
124
|
+
- name: job-b
|
|
125
|
+
skip: true
|
|
126
|
+
# ❌ Wrong: "false" == false is always false in Actions expressions
|
|
127
|
+
if: ${{ matrix.skip == false }}
|
|
128
|
+
steps:
|
|
129
|
+
- run: echo "This never runs for any include entry"
|
|
130
|
+
prevention:
|
|
131
|
+
- 'Always wrap boolean matrix property references in fromJSON() — e.g., if: ${{ fromJSON(matrix.enabled) }}'
|
|
132
|
+
- 'Add a test matrix entry with the boolean set to false and verify the job is actually skipped before relying on the condition in production'
|
|
133
|
+
- 'Consider using string sentinel values (e.g., skip: "yes"/"no") and comparing with == to avoid the boolean coercion ambiguity entirely'
|
|
134
|
+
- 'Document in the workflow that all matrix properties are runtime strings — reviewers often assume boolean values remain boolean'
|
|
135
|
+
docs:
|
|
136
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-a-matrix-for-your-jobs'
|
|
137
|
+
label: 'Using a matrix for your jobs — GitHub Actions docs'
|
|
138
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#fromjson'
|
|
139
|
+
label: 'fromJSON() expression function — GitHub Actions docs'
|
|
140
|
+
- url: 'https://stackoverflow.com/questions/77059002/how-to-use-matrix-variables-to-conditionally-run-jobs-in-a-github-actions-workfl'
|
|
141
|
+
label: 'Stack Overflow Q77059002 — matrix boolean coercion and fromJSON() fix'
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
id: silent-failures-104
|
|
2
|
+
title: '`github.event.inputs.X` Returns Empty String (Not Declared Default) for `on: schedule` and Other Non-Dispatch Triggers — Use `inputs.X` Instead'
|
|
3
|
+
category: silent-failures
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- github-event-inputs
|
|
7
|
+
- inputs-context
|
|
8
|
+
- schedule
|
|
9
|
+
- workflow-dispatch
|
|
10
|
+
- multi-trigger
|
|
11
|
+
- empty-string
|
|
12
|
+
- default-value
|
|
13
|
+
- context
|
|
14
|
+
- boolean-input
|
|
15
|
+
patterns:
|
|
16
|
+
- regex: 'github\.event\.inputs\.[a-zA-Z_][a-zA-Z0-9_-]*'
|
|
17
|
+
flags: 'g'
|
|
18
|
+
- regex: 'on:\s*\n(?:.*\n)*?\s+schedule:'
|
|
19
|
+
flags: 'im'
|
|
20
|
+
error_messages:
|
|
21
|
+
- "Deploy target is empty — expected a non-empty value from github.event.inputs.environment"
|
|
22
|
+
- "Error: Input required and not supplied"
|
|
23
|
+
- "github.event.inputs.dry_run was '' but expected 'false'"
|
|
24
|
+
root_cause: |
|
|
25
|
+
Multi-trigger workflows that combine `on: schedule` (or `on: push`, `on: pull_request`,
|
|
26
|
+
etc.) with `on: workflow_dispatch` commonly read input values via
|
|
27
|
+
`${{ github.event.inputs.X }}`. This silently produces wrong results for all
|
|
28
|
+
non-dispatch runs because:
|
|
29
|
+
|
|
30
|
+
- **`github.event.inputs.X`** is populated ONLY when the workflow is triggered via
|
|
31
|
+
`workflow_dispatch`. For every other event type — including `schedule`, `push`,
|
|
32
|
+
and `pull_request` — `github.event.inputs` is null or an empty object. Accessing a
|
|
33
|
+
property returns `""` (empty string). The `default:` declared in the `inputs:` block
|
|
34
|
+
is NEVER applied through this context.
|
|
35
|
+
|
|
36
|
+
- **`inputs.X`** correctly returns the declared `default:` value for non-dispatch
|
|
37
|
+
triggers, and the actual provided value for dispatch-triggered runs.
|
|
38
|
+
|
|
39
|
+
**Silent failure patterns:**
|
|
40
|
+
|
|
41
|
+
1. **Boolean gate inverted on schedule** — `if: github.event.inputs.dry_run == 'false'`
|
|
42
|
+
evaluates to `false` on schedule runs (because `"" != "false"`), so deployment steps
|
|
43
|
+
that should run on the nightly schedule are silently skipped.
|
|
44
|
+
|
|
45
|
+
2. **Non-empty guard always fails** — `if: github.event.inputs.target != ''` is always
|
|
46
|
+
`false` on schedule even when the intended behavior is to run with the default target.
|
|
47
|
+
|
|
48
|
+
3. **String comparison breaks** — `${{ github.event.inputs.environment == 'staging' }}`
|
|
49
|
+
is `false` on schedule because the empty string does not match any environment name.
|
|
50
|
+
|
|
51
|
+
Unlike `inputs.X`, `github.event.inputs.X` has no concept of a fallback default — it
|
|
52
|
+
returns `""` for every non-dispatch event.
|
|
53
|
+
|
|
54
|
+
**Distinct from sf-077** (which covers `workflow_call` — where `github.event.inputs`
|
|
55
|
+
is null because reusable workflows use the `inputs` context, not `github.event.inputs`).
|
|
56
|
+
**Distinct from sf-072** (which covers the `inputs.X` context being empty on non-dispatch,
|
|
57
|
+
not the `github.event.inputs.X` context).
|
|
58
|
+
fix: |
|
|
59
|
+
Replace all `github.event.inputs.X` references with `inputs.X` in any workflow that
|
|
60
|
+
uses multiple triggers. The `inputs` context is populated for `workflow_dispatch` and
|
|
61
|
+
`workflow_call` events, and returns the declared `default:` value for all other triggers.
|
|
62
|
+
fix_code:
|
|
63
|
+
- language: yaml
|
|
64
|
+
label: "Broken — github.event.inputs.X ignores defaults on schedule runs"
|
|
65
|
+
code: |
|
|
66
|
+
on:
|
|
67
|
+
schedule:
|
|
68
|
+
- cron: '0 2 * * *'
|
|
69
|
+
workflow_dispatch:
|
|
70
|
+
inputs:
|
|
71
|
+
dry_run:
|
|
72
|
+
type: boolean
|
|
73
|
+
default: false
|
|
74
|
+
environment:
|
|
75
|
+
type: string
|
|
76
|
+
default: production
|
|
77
|
+
|
|
78
|
+
jobs:
|
|
79
|
+
deploy:
|
|
80
|
+
steps:
|
|
81
|
+
# ❌ On schedule: dry_run="" (not "false"), environment="" (not "production")
|
|
82
|
+
- run: echo "Env=${{ github.event.inputs.environment }}"
|
|
83
|
+
# ❌ This if-condition is always false on schedule — step silently skipped!
|
|
84
|
+
- if: github.event.inputs.dry_run == 'false'
|
|
85
|
+
run: ./deploy.sh --env ${{ github.event.inputs.environment }}
|
|
86
|
+
- language: yaml
|
|
87
|
+
label: "Fixed — use inputs.X which applies declared defaults on all non-dispatch runs"
|
|
88
|
+
code: |
|
|
89
|
+
on:
|
|
90
|
+
schedule:
|
|
91
|
+
- cron: '0 2 * * *'
|
|
92
|
+
workflow_dispatch:
|
|
93
|
+
inputs:
|
|
94
|
+
dry_run:
|
|
95
|
+
type: boolean
|
|
96
|
+
default: false
|
|
97
|
+
environment:
|
|
98
|
+
type: string
|
|
99
|
+
default: production
|
|
100
|
+
|
|
101
|
+
jobs:
|
|
102
|
+
deploy:
|
|
103
|
+
steps:
|
|
104
|
+
# ✓ On schedule: dry_run="false", environment="production" (defaults applied)
|
|
105
|
+
- run: echo "Env=${{ inputs.environment }}"
|
|
106
|
+
# ✓ Correctly runs on schedule (dry_run defaults to "false")
|
|
107
|
+
- if: inputs.dry_run == 'false'
|
|
108
|
+
run: ./deploy.sh --env ${{ inputs.environment }}
|
|
109
|
+
prevention:
|
|
110
|
+
- "Always use `inputs.X` (not `github.event.inputs.X`) in any workflow with more than one trigger — `inputs.X` applies declared defaults for non-dispatch runs"
|
|
111
|
+
- "Audit all `github.event.inputs.*` references in workflows that also include `on: schedule`, `on: push`, or `on: pull_request` triggers"
|
|
112
|
+
- "Add a debug step in the workflow to log `inputs.*` values on each run — catching empty-input regressions before they cause silent deploy failures"
|
|
113
|
+
docs:
|
|
114
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#inputs-context"
|
|
115
|
+
label: "GitHub Actions inputs context — recommended approach for reading workflow inputs"
|
|
116
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#context-availability"
|
|
117
|
+
label: "Context availability — github.event.inputs is only set for workflow_dispatch triggers"
|
|
118
|
+
- url: "https://github.com/orgs/community/discussions"
|
|
119
|
+
label: "GitHub Community Discussions — multi-trigger workflows with workflow_dispatch inputs"
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
id: yaml-syntax-068
|
|
2
|
+
title: 'Composite Action run: Steps Use Caller Workspace as Working Directory — github.action_path Required for Bundled Scripts'
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- composite-action
|
|
7
|
+
- github-action-path
|
|
8
|
+
- working-directory
|
|
9
|
+
- relative-path
|
|
10
|
+
- script
|
|
11
|
+
- file-not-found
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: 'run:\s*\./[^\s]+'
|
|
14
|
+
flags: 'i'
|
|
15
|
+
- regex: 'No such file or directory.*\./'
|
|
16
|
+
flags: 'i'
|
|
17
|
+
- regex: 'bash:.*\./.*: No such file or directory'
|
|
18
|
+
flags: 'i'
|
|
19
|
+
error_messages:
|
|
20
|
+
- "bash: ./scripts/build.sh: No such file or directory"
|
|
21
|
+
- "/bin/bash: ./entrypoint.sh: No such file or directory"
|
|
22
|
+
- "Error: Process completed with exit code 127."
|
|
23
|
+
- "bash: line 1: ./setup.sh: No such file or directory"
|
|
24
|
+
root_cause: |
|
|
25
|
+
When a composite action (whether local `uses: ./` or published `uses: org/action@v1`) runs a
|
|
26
|
+
`run:` step, the **working directory is the caller's workspace** (`github.workspace`), not the
|
|
27
|
+
action's own directory. Any relative path like `run: ./scripts/build.sh` resolves against the
|
|
28
|
+
caller repository root — not the composite action's repository.
|
|
29
|
+
|
|
30
|
+
This affects both published composite actions (referenced as `uses: org/my-action@v1`) and
|
|
31
|
+
local composite actions stored inside the same repository. Developers commonly write:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# In action.yml of org/my-action
|
|
35
|
+
runs:
|
|
36
|
+
using: composite
|
|
37
|
+
steps:
|
|
38
|
+
- name: Run bundled script
|
|
39
|
+
run: ./scripts/build.sh # ❌ Resolves against CALLER workspace, not action directory
|
|
40
|
+
shell: bash
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
When a caller uses `uses: org/my-action@v1`, `./scripts/build.sh` resolves to the caller's
|
|
44
|
+
`$GITHUB_WORKSPACE/scripts/build.sh`, which does not exist — producing "No such file or
|
|
45
|
+
directory" or exit code 127.
|
|
46
|
+
|
|
47
|
+
**Contrast with JavaScript/Docker actions:** In those action types, the action executes in its
|
|
48
|
+
own context. Composite actions are different — their steps are injected into the caller's
|
|
49
|
+
job environment and run with the caller's working directory.
|
|
50
|
+
|
|
51
|
+
The correct way to reference files bundled inside a composite action is to use
|
|
52
|
+
`${{ github.action_path }}`, which always points to the directory containing the action's
|
|
53
|
+
`action.yml` file, regardless of where the action is called from.
|
|
54
|
+
fix: |
|
|
55
|
+
Replace relative paths in composite action `run:` steps with `${{ github.action_path }}/`:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
# In action.yml
|
|
59
|
+
runs:
|
|
60
|
+
using: composite
|
|
61
|
+
steps:
|
|
62
|
+
- name: Run bundled script
|
|
63
|
+
run: ${{ github.action_path }}/scripts/build.sh # ✅ Always resolves to action directory
|
|
64
|
+
shell: bash
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If the script must be made executable, add a `chmod` step using `github.action_path`:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
steps:
|
|
71
|
+
- name: Make script executable
|
|
72
|
+
run: chmod +x ${{ github.action_path }}/scripts/build.sh
|
|
73
|
+
shell: bash
|
|
74
|
+
|
|
75
|
+
- name: Run bundled script
|
|
76
|
+
run: ${{ github.action_path }}/scripts/build.sh
|
|
77
|
+
shell: bash
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`github.action_path` is always set to the directory of the currently executing action's
|
|
81
|
+
`action.yml`, even for deeply nested composite actions calling other composite actions.
|
|
82
|
+
fix_code:
|
|
83
|
+
- language: yaml
|
|
84
|
+
label: 'Correct: github.action_path for bundled scripts'
|
|
85
|
+
code: |
|
|
86
|
+
# In action.yml of your composite action (org/my-action)
|
|
87
|
+
name: 'My Action'
|
|
88
|
+
description: 'Does something useful'
|
|
89
|
+
runs:
|
|
90
|
+
using: composite
|
|
91
|
+
steps:
|
|
92
|
+
- name: Make script executable
|
|
93
|
+
run: chmod +x ${{ github.action_path }}/scripts/build.sh
|
|
94
|
+
shell: bash
|
|
95
|
+
|
|
96
|
+
- name: Run bundled build script
|
|
97
|
+
# ✅ github.action_path always points to the action's directory
|
|
98
|
+
run: ${{ github.action_path }}/scripts/build.sh
|
|
99
|
+
shell: bash
|
|
100
|
+
|
|
101
|
+
- name: Run inline Python from action directory
|
|
102
|
+
run: python ${{ github.action_path }}/tools/generate.py
|
|
103
|
+
shell: bash
|
|
104
|
+
|
|
105
|
+
- language: yaml
|
|
106
|
+
label: 'Wrong: relative path resolves against caller workspace'
|
|
107
|
+
code: |
|
|
108
|
+
# In action.yml of your composite action (org/my-action)
|
|
109
|
+
name: 'My Action'
|
|
110
|
+
runs:
|
|
111
|
+
using: composite
|
|
112
|
+
steps:
|
|
113
|
+
- name: Run bundled script
|
|
114
|
+
# ❌ Wrong: ./scripts/build.sh resolves against the CALLER's $GITHUB_WORKSPACE
|
|
115
|
+
# Fails with: bash: ./scripts/build.sh: No such file or directory
|
|
116
|
+
run: ./scripts/build.sh
|
|
117
|
+
shell: bash
|
|
118
|
+
|
|
119
|
+
# ❌ Also wrong: explicitly using github.workspace points to caller repo root
|
|
120
|
+
- name: Run script using workspace
|
|
121
|
+
run: ${{ github.workspace }}/scripts/build.sh
|
|
122
|
+
shell: bash
|
|
123
|
+
|
|
124
|
+
prevention:
|
|
125
|
+
- 'Never use relative paths (./path) or github.workspace in composite action run: steps to reference the action''s own bundled files — always use github.action_path'
|
|
126
|
+
- 'Test composite actions by calling them from a separate test repository, not just the same repository where they are defined — relative paths that work locally (same repo) silently break when called externally'
|
|
127
|
+
- 'Add a step to verify the script exists at the expected path as the first step of your composite action during development: run: ls ${{ github.action_path }}/scripts/'
|
|
128
|
+
- 'Composite actions that call other composite actions each get their own github.action_path — do not pass it between actions as an input'
|
|
129
|
+
docs:
|
|
130
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#github-context'
|
|
131
|
+
label: 'github.action_path context — GitHub Actions docs'
|
|
132
|
+
- url: 'https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action'
|
|
133
|
+
label: 'Creating a composite action — GitHub Actions docs'
|
|
134
|
+
- url: 'https://github.com/actions/runner/issues/1348'
|
|
135
|
+
label: 'actions/runner#1348 — Local composite actions always relative to top level repository'
|
|
136
|
+
- url: 'https://stackoverflow.com/questions/77033208/github-action-composite-type-not-working-in-other-repositories-due-to-missing'
|
|
137
|
+
label: 'Stack Overflow — Composite action not working in other repositories due to missing action files'
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
id: yaml-syntax-069
|
|
2
|
+
title: 'Job-level `env:` Variables Silently Resolve to Empty String in `services.*.image` and `container.image`'
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- services
|
|
7
|
+
- container
|
|
8
|
+
- env-context
|
|
9
|
+
- image
|
|
10
|
+
- context-availability
|
|
11
|
+
- job-level-env
|
|
12
|
+
- silent-failure
|
|
13
|
+
patterns:
|
|
14
|
+
- regex: 'image:\s*\S*\$\{\{\s*env\.'
|
|
15
|
+
flags: 'im'
|
|
16
|
+
- regex: 'Error response from daemon: manifest for \S+: not found'
|
|
17
|
+
flags: 'i'
|
|
18
|
+
- regex: 'invalid reference format'
|
|
19
|
+
flags: 'i'
|
|
20
|
+
error_messages:
|
|
21
|
+
- "Error response from daemon: manifest for redis: not found: manifest unknown"
|
|
22
|
+
- "Error response from daemon: manifest for postgres: not found"
|
|
23
|
+
- "invalid reference format"
|
|
24
|
+
- "Error: Container action is using an invalid image"
|
|
25
|
+
- "Unable to pull image 'redis:': invalid reference format"
|
|
26
|
+
root_cause: |
|
|
27
|
+
GitHub Actions evaluates `services.*.image` and `container.image` expressions BEFORE
|
|
28
|
+
the job's environment scope is initialized. At evaluation time, the `env` context only
|
|
29
|
+
contains WORKFLOW-level `env:` variables (defined in the top-level `env:` block). Any
|
|
30
|
+
`env:` variable declared inside `jobs.<job_id>.env:` is NOT yet in scope and silently
|
|
31
|
+
evaluates to empty string `""`.
|
|
32
|
+
|
|
33
|
+
Example of the broken pattern:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
jobs:
|
|
37
|
+
test:
|
|
38
|
+
env:
|
|
39
|
+
REDIS_VERSION: '7.2' # ← job-level env: NOT available in services below
|
|
40
|
+
services:
|
|
41
|
+
redis:
|
|
42
|
+
image: 'redis:${{ env.REDIS_VERSION }}' # ← evaluates to "redis:" (empty tag)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The expression `redis:${{ env.REDIS_VERSION }}` resolves to `redis:` which Docker treats
|
|
46
|
+
as an invalid or missing tag, causing the service to fail to start — often with
|
|
47
|
+
"manifest not found" or "invalid reference format" errors.
|
|
48
|
+
|
|
49
|
+
**Context availability in `services.*.image` and `container.image`**:
|
|
50
|
+
|
|
51
|
+
| Context | Available? |
|
|
52
|
+
|---------------|------------|
|
|
53
|
+
| `github` | ✅ Yes |
|
|
54
|
+
| `inputs` | ✅ Yes |
|
|
55
|
+
| `vars` | ✅ Yes |
|
|
56
|
+
| `secrets` | ✅ Yes |
|
|
57
|
+
| `matrix` | ✅ Yes |
|
|
58
|
+
| `env` (workflow-level) | ✅ Yes |
|
|
59
|
+
| `env` (job-level) | ❌ No — silently empty |
|
|
60
|
+
| `steps.*` | ❌ No — no steps have run yet |
|
|
61
|
+
| `needs.*` | ❌ No |
|
|
62
|
+
|
|
63
|
+
This affects any image version that a developer attempts to centralize in their job's
|
|
64
|
+
local `env:` block — a common pattern for organizing service dependencies.
|
|
65
|
+
fix: |
|
|
66
|
+
Move the image-version environment variable from the job-level `env:` block to the
|
|
67
|
+
WORKFLOW-level `env:` block (outside `jobs:`). Alternatively, use `vars` context
|
|
68
|
+
(repository/org variables) for externalized configuration, or pin the version inline.
|
|
69
|
+
fix_code:
|
|
70
|
+
- language: yaml
|
|
71
|
+
label: "Broken — job-level env silently empty in services.image"
|
|
72
|
+
code: |
|
|
73
|
+
jobs:
|
|
74
|
+
test:
|
|
75
|
+
env:
|
|
76
|
+
REDIS_VERSION: '7.2' # ← job-level: NOT visible in services below
|
|
77
|
+
services:
|
|
78
|
+
redis:
|
|
79
|
+
image: 'redis:${{ env.REDIS_VERSION }}' # resolves to "redis:" — fails
|
|
80
|
+
- language: yaml
|
|
81
|
+
label: "Fixed — move version to workflow-level env"
|
|
82
|
+
code: |
|
|
83
|
+
env:
|
|
84
|
+
REDIS_VERSION: '7.2' # ← workflow-level: visible in services.image
|
|
85
|
+
|
|
86
|
+
jobs:
|
|
87
|
+
test:
|
|
88
|
+
services:
|
|
89
|
+
redis:
|
|
90
|
+
image: 'redis:${{ env.REDIS_VERSION }}' # resolves to "redis:7.2" ✓
|
|
91
|
+
- language: yaml
|
|
92
|
+
label: "Alternative — use vars context (repository variable)"
|
|
93
|
+
code: |
|
|
94
|
+
# Set REDIS_VERSION in repository Settings → Secrets and variables → Variables
|
|
95
|
+
jobs:
|
|
96
|
+
test:
|
|
97
|
+
services:
|
|
98
|
+
redis:
|
|
99
|
+
image: 'redis:${{ vars.REDIS_VERSION }}' # always available ✓
|
|
100
|
+
- language: yaml
|
|
101
|
+
label: "Alternative — pin version inline (simplest)"
|
|
102
|
+
code: |
|
|
103
|
+
jobs:
|
|
104
|
+
test:
|
|
105
|
+
services:
|
|
106
|
+
redis:
|
|
107
|
+
image: 'redis:7.2' # no expression needed if version doesn't change often
|
|
108
|
+
prevention:
|
|
109
|
+
- "Always define image-version env vars at the WORKFLOW level (top-level `env:`) when they are referenced in `services:` or `container:`"
|
|
110
|
+
- "Lint workflows with the GitHub VS Code extension or actionlint — it flags unsupported context references in service/container image fields"
|
|
111
|
+
- "When a service fails to pull, check the exact image name in the runner log — an empty or malformed tag (e.g., `redis:`) indicates this context-availability issue"
|
|
112
|
+
docs:
|
|
113
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#context-availability"
|
|
114
|
+
label: "GitHub Actions context availability — which contexts are valid in each workflow field"
|
|
115
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idimage"
|
|
116
|
+
label: "jobs.<job_id>.services.<service_id>.image — workflow syntax reference"
|
|
117
|
+
- url: "https://github.com/orgs/community/discussions"
|
|
118
|
+
label: "GitHub Community Discussions — GitHub Actions service container configuration"
|
package/package.json
CHANGED