@htekdev/actions-debugger 1.0.92 → 1.0.93
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/permissions-auth/github-models-missing-models-read-permission.yml +115 -0
- package/errors/runner-environment/setup-go-gotoolchain-auto-download.yml +122 -0
- package/errors/triggers/deployment-status-all-types-default.yml +123 -0
- package/errors/yaml-syntax/workflow-call-boolean-input-default-string.yml +122 -0
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
id: permissions-auth-052
|
|
2
|
+
title: 'GitHub Models API in Actions requires models: read permission — not in default GITHUB_TOKEN scopes'
|
|
3
|
+
category: permissions-auth
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- models
|
|
7
|
+
- github-models
|
|
8
|
+
- ai
|
|
9
|
+
- permissions
|
|
10
|
+
- GITHUB_TOKEN
|
|
11
|
+
- 403
|
|
12
|
+
- inference
|
|
13
|
+
patterns:
|
|
14
|
+
- regex: 'models:\s*read'
|
|
15
|
+
flags: 'i'
|
|
16
|
+
- regex: 'Resource not accessible by integration.*model'
|
|
17
|
+
flags: 'i'
|
|
18
|
+
- regex: 'models.*permission.*required|permission.*models.*required'
|
|
19
|
+
flags: 'i'
|
|
20
|
+
- regex: '403.*github\.com/models|github\.com/models.*403'
|
|
21
|
+
flags: 'i'
|
|
22
|
+
error_messages:
|
|
23
|
+
- 'Error: Resource not accessible by integration'
|
|
24
|
+
- '403 Forbidden — models: read permission is required'
|
|
25
|
+
- 'HttpError: 403 Resource not accessible by integration'
|
|
26
|
+
- 'Error: The models permission is required to use the GitHub Models API'
|
|
27
|
+
root_cause: |
|
|
28
|
+
GitHub Models (launched in 2024) provides access to AI inference models (GPT-4o,
|
|
29
|
+
Claude, Llama, etc.) via the GitHub Models API at https://models.inference.ai.azure.com
|
|
30
|
+
and via the GitHub REST API at api.github.com/models. When workflows use these
|
|
31
|
+
endpoints with the GITHUB_TOKEN (for example, via `actions/ai-inference` or via
|
|
32
|
+
`actions/github-script` calling `github.rest.models.*`), the token must have the
|
|
33
|
+
`models: read` permission explicitly declared.
|
|
34
|
+
|
|
35
|
+
The `models: read` permission was introduced as a new GITHUB_TOKEN scope alongside
|
|
36
|
+
the GitHub Models feature. It is NOT included in the default GITHUB_TOKEN permissions
|
|
37
|
+
and is NOT implied by any other existing permission (not `contents: read`, not
|
|
38
|
+
`packages: read`, not `id-token: write`).
|
|
39
|
+
|
|
40
|
+
Common failure patterns:
|
|
41
|
+
1. Adding an AI inference step or action to an existing workflow that has a
|
|
42
|
+
permissions: block — the block narrows all unspecified permissions to none,
|
|
43
|
+
and models: read was never added.
|
|
44
|
+
2. Using GitHub Models for the first time in a workflow that relies on the
|
|
45
|
+
repository's default "Read and write" permissions — models: read is not
|
|
46
|
+
included even in the broadest default permission set.
|
|
47
|
+
3. Reusable workflow callers that use `secrets: inherit` but do NOT pass through
|
|
48
|
+
permissions — the called workflow must declare its own `models: read`.
|
|
49
|
+
4. Fine-grained PATs used as a token override: the PAT must have the "Models: read"
|
|
50
|
+
resource permission enabled for the target repository or organization.
|
|
51
|
+
|
|
52
|
+
The error message "Resource not accessible by integration" is the same 403 error
|
|
53
|
+
used for other missing permissions, making it hard to identify models: read as the
|
|
54
|
+
specific missing scope without checking the API response body.
|
|
55
|
+
fix: |
|
|
56
|
+
Add `models: read` to the `permissions:` block of the job (or workflow) that calls
|
|
57
|
+
the GitHub Models API. If using a fine-grained PAT instead of GITHUB_TOKEN, ensure
|
|
58
|
+
the PAT has the "Models" permission enabled.
|
|
59
|
+
fix_code:
|
|
60
|
+
- language: yaml
|
|
61
|
+
label: 'Add models: read to job permissions for AI inference steps'
|
|
62
|
+
code: |
|
|
63
|
+
jobs:
|
|
64
|
+
ai-analysis:
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
permissions:
|
|
67
|
+
contents: read
|
|
68
|
+
models: read # Required for GitHub Models API access
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
- name: Run AI inference via GitHub Models
|
|
72
|
+
uses: actions/ai-inference@v1
|
|
73
|
+
with:
|
|
74
|
+
model: openai/gpt-4o
|
|
75
|
+
system-prompt: 'You are a code reviewer. Be concise.'
|
|
76
|
+
user-prompt: 'Review the changes in this PR for security issues.'
|
|
77
|
+
- language: yaml
|
|
78
|
+
label: 'Workflow with multiple permissions including models: read'
|
|
79
|
+
code: |
|
|
80
|
+
on:
|
|
81
|
+
pull_request:
|
|
82
|
+
|
|
83
|
+
permissions:
|
|
84
|
+
contents: read
|
|
85
|
+
pull-requests: write
|
|
86
|
+
models: read # Required for any AI model inference step
|
|
87
|
+
|
|
88
|
+
jobs:
|
|
89
|
+
review:
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v4
|
|
93
|
+
- name: AI code review
|
|
94
|
+
uses: actions/github-script@v7
|
|
95
|
+
with:
|
|
96
|
+
script: |
|
|
97
|
+
// github.rest.models requires models: read permission
|
|
98
|
+
const response = await github.request('POST /repos/{owner}/{repo}/actions/generate-summary', {
|
|
99
|
+
owner: context.repo.owner,
|
|
100
|
+
repo: context.repo.repo
|
|
101
|
+
});
|
|
102
|
+
prevention:
|
|
103
|
+
- "Always add `models: read` to the permissions block when using GitHub Models API, AI inference actions, or any `github.rest.models.*` API calls"
|
|
104
|
+
- "The `models: read` scope is not inherited, implied, or included in any default permission set — it must be declared explicitly"
|
|
105
|
+
- "When upgrading a workflow to add AI features, audit the existing permissions: block and add models: read before deploying"
|
|
106
|
+
- "Fine-grained PATs used as token overrides must explicitly include the Models permission for the relevant repositories"
|
|
107
|
+
docs:
|
|
108
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token'
|
|
109
|
+
label: 'GitHub Docs: Controlling permissions for GITHUB_TOKEN — available scopes'
|
|
110
|
+
- url: 'https://docs.github.com/en/github-models/use-github-models/integrating-ai-models-into-your-application'
|
|
111
|
+
label: 'GitHub Docs: Using GitHub Models — authentication and permissions'
|
|
112
|
+
- url: 'https://github.com/actions/ai-inference'
|
|
113
|
+
label: 'actions/ai-inference — GitHub Models inference action'
|
|
114
|
+
- url: 'https://github.com/marketplace/actions/ai-inference'
|
|
115
|
+
label: 'GitHub Marketplace: AI Inference action'
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
id: runner-environment-159
|
|
2
|
+
title: 'setup-go@v5 with Go 1.21+ toolchain directive — GOTOOLCHAIN=auto downloads newer Go toolchain mid-CI'
|
|
3
|
+
category: runner-environment
|
|
4
|
+
severity: warning
|
|
5
|
+
tags:
|
|
6
|
+
- setup-go
|
|
7
|
+
- go
|
|
8
|
+
- gotoolchain
|
|
9
|
+
- toolchain-directive
|
|
10
|
+
- go-version
|
|
11
|
+
- network
|
|
12
|
+
- go-mod
|
|
13
|
+
patterns:
|
|
14
|
+
- regex: 'go: downloading go1\.\d+\.\d+ \(linux/amd64\)'
|
|
15
|
+
flags: 'i'
|
|
16
|
+
- regex: 'go: module requires GOTOOLCHAIN at least go1\.'
|
|
17
|
+
flags: 'i'
|
|
18
|
+
- regex: 'go: toolchain.*not available'
|
|
19
|
+
flags: 'i'
|
|
20
|
+
- regex: 'toolchain go1\.\d+\.\d+ required, have go1\.'
|
|
21
|
+
flags: 'i'
|
|
22
|
+
error_messages:
|
|
23
|
+
- 'go: downloading go1.22.3 (linux/amd64)'
|
|
24
|
+
- 'go: module requires GOTOOLCHAIN at least go1.22.0'
|
|
25
|
+
- 'go: toolchain download not available: dial tcp: lookup proxy.golang.org: no such host'
|
|
26
|
+
- 'toolchain go1.22.3 required, have go1.21.13'
|
|
27
|
+
root_cause: |
|
|
28
|
+
Go 1.21 introduced the `toolchain` directive in `go.mod` and `go.sum`, along with the
|
|
29
|
+
`GOTOOLCHAIN` environment variable that controls toolchain version management. The default
|
|
30
|
+
value `GOTOOLCHAIN=auto` causes the Go runtime to automatically download a newer Go
|
|
31
|
+
toolchain if the installed version is older than the version specified by the `toolchain`
|
|
32
|
+
directive (or the `go` directive when no explicit `toolchain` key exists).
|
|
33
|
+
|
|
34
|
+
When `actions/setup-go@v5` installs Go 1.21.x but the project's `go.mod` contains:
|
|
35
|
+
toolchain go1.22.3
|
|
36
|
+
Go will automatically attempt to download the go1.22.3 toolchain from proxy.golang.org
|
|
37
|
+
at runtime — during `go build`, `go test`, or any go command. This download adds
|
|
38
|
+
15-120 seconds to CI jobs and can fail entirely in:
|
|
39
|
+
- Self-hosted runners in air-gapped or network-restricted environments
|
|
40
|
+
- Runners with strict egress firewall rules blocking proxy.golang.org
|
|
41
|
+
- Flaky network conditions during toolchain resolution
|
|
42
|
+
|
|
43
|
+
The behavior is often invisible in logs because the download proceeds silently before
|
|
44
|
+
each `go` invocation. The symptom is slower-than-expected build times or a cryptic
|
|
45
|
+
`dial tcp: lookup proxy.golang.org: no such host` error that appears unrelated to
|
|
46
|
+
the Go version.
|
|
47
|
+
|
|
48
|
+
Note: This is distinct from the Go 1.23 telemetry cache tar collision
|
|
49
|
+
(runner-environment-041). That is a cache restore bug; this is an unexpected network
|
|
50
|
+
download triggered by the toolchain directive.
|
|
51
|
+
fix: |
|
|
52
|
+
Option 1 (recommended): Set `GOTOOLCHAIN=local` to prevent auto-downloads and fail fast
|
|
53
|
+
if the installed version doesn't satisfy the toolchain directive. Then configure
|
|
54
|
+
`actions/setup-go@v5` to install exactly the required Go version.
|
|
55
|
+
|
|
56
|
+
Option 2: Use `go-version-file: go.mod` so that setup-go installs the exact Go version
|
|
57
|
+
matching the `go` line in go.mod — ensure this matches or exceeds the `toolchain`
|
|
58
|
+
directive to prevent downloads.
|
|
59
|
+
|
|
60
|
+
Option 3: Remove the `toolchain` directive from `go.mod` if it is not intentionally
|
|
61
|
+
pinning a minimum toolchain version. The directive was added automatically by
|
|
62
|
+
`go mod tidy` in Go 1.21+ and many projects don't need it.
|
|
63
|
+
fix_code:
|
|
64
|
+
- language: yaml
|
|
65
|
+
label: 'Set GOTOOLCHAIN=local to prevent mid-CI toolchain downloads'
|
|
66
|
+
code: |
|
|
67
|
+
jobs:
|
|
68
|
+
build:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
env:
|
|
71
|
+
GOTOOLCHAIN: local # Never auto-download; use only the installed toolchain
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- uses: actions/setup-go@v5
|
|
75
|
+
with:
|
|
76
|
+
go-version: '1.22.x' # Install the exact version needed by go.mod
|
|
77
|
+
cache: true
|
|
78
|
+
- run: go build ./...
|
|
79
|
+
- language: yaml
|
|
80
|
+
label: 'Use go-version-file to pin version from go.mod'
|
|
81
|
+
code: |
|
|
82
|
+
jobs:
|
|
83
|
+
build:
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
env:
|
|
86
|
+
GOTOOLCHAIN: local
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v4
|
|
89
|
+
- uses: actions/setup-go@v5
|
|
90
|
+
with:
|
|
91
|
+
go-version-file: go.mod # Reads 'go' directive from go.mod
|
|
92
|
+
cache: true
|
|
93
|
+
# go.mod should specify 'go 1.22.3' matching or exceeding the toolchain directive
|
|
94
|
+
- run: go build ./...
|
|
95
|
+
- language: yaml
|
|
96
|
+
label: 'Remove toolchain directive from go.mod to avoid the download trigger'
|
|
97
|
+
code: |
|
|
98
|
+
# In go.mod, remove the toolchain line if your project does not require a
|
|
99
|
+
# minimum toolchain version beyond what setup-go installs:
|
|
100
|
+
# BEFORE (triggers GOTOOLCHAIN=auto download):
|
|
101
|
+
# go 1.21
|
|
102
|
+
# toolchain go1.22.3
|
|
103
|
+
#
|
|
104
|
+
# AFTER (no automatic download):
|
|
105
|
+
# go 1.22.3
|
|
106
|
+
# (no toolchain directive)
|
|
107
|
+
#
|
|
108
|
+
# Run `go mod tidy` with GOTOOLCHAIN=local after editing go.mod to clean up.
|
|
109
|
+
prevention:
|
|
110
|
+
- "Set `GOTOOLCHAIN: local` as a job-level env var in all Go workflows to prevent unexpected toolchain downloads"
|
|
111
|
+
- "When upgrading Go versions, use `go-version-file: go.mod` in setup-go so CI always installs the correct version"
|
|
112
|
+
- "After running `go mod tidy` locally with Go 1.21+, check whether a `toolchain` directive was added to go.mod before committing"
|
|
113
|
+
- "In air-gapped environments, always set GOTOOLCHAIN=local and pre-bake the required toolchain into the self-hosted runner image"
|
|
114
|
+
docs:
|
|
115
|
+
- url: 'https://go.dev/doc/toolchain'
|
|
116
|
+
label: 'Go Toolchains — official documentation for GOTOOLCHAIN and toolchain directive'
|
|
117
|
+
- url: 'https://go.dev/blog/toolchain'
|
|
118
|
+
label: 'Go Blog: Go Toolchains (Go 1.21 announcement)'
|
|
119
|
+
- url: 'https://github.com/actions/setup-go/blob/main/README.md'
|
|
120
|
+
label: 'actions/setup-go README — go-version-file input'
|
|
121
|
+
- url: 'https://pkg.go.dev/cmd/go#hdr-Go_toolchain_management'
|
|
122
|
+
label: 'go command: toolchain management — GOTOOLCHAIN environment variable'
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
id: triggers-063
|
|
2
|
+
title: 'on.deployment_status fires for all deployment lifecycle statuses by default — add types: to filter'
|
|
3
|
+
category: triggers
|
|
4
|
+
severity: warning
|
|
5
|
+
tags:
|
|
6
|
+
- deployment_status
|
|
7
|
+
- deployment
|
|
8
|
+
- event-types
|
|
9
|
+
- trigger
|
|
10
|
+
- duplicate-runs
|
|
11
|
+
- types-filter
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: 'on:\s*\n\s*deployment_status:'
|
|
14
|
+
flags: 'ms'
|
|
15
|
+
- regex: 'deployment_status:\s*$'
|
|
16
|
+
flags: 'i'
|
|
17
|
+
error_messages:
|
|
18
|
+
- '(no error — workflow fires unexpectedly multiple times per deployment)'
|
|
19
|
+
root_cause: |
|
|
20
|
+
The `on.deployment_status` event fires whenever the status of a deployment changes.
|
|
21
|
+
A single end-to-end deployment lifecycle emits SIX distinct status events in sequence:
|
|
22
|
+
created → queued → in_progress → success (or failure / error)
|
|
23
|
+
Plus `inactive` when an older deployment is superseded by a new one.
|
|
24
|
+
|
|
25
|
+
When a workflow uses `on: deployment_status:` without a `types:` filter, it runs for
|
|
26
|
+
EVERY one of these status transitions. For a typical deployment:
|
|
27
|
+
- GitHub creates the deployment (fires `deployment_status` with state `created`)
|
|
28
|
+
- The deployment starts running (fires `in_progress`)
|
|
29
|
+
- The deployment completes (fires `success`)
|
|
30
|
+
- Any prior deployment for the same environment becomes inactive (fires `inactive`)
|
|
31
|
+
|
|
32
|
+
This causes a workflow to run 3-4 times per deployment. Common consequences:
|
|
33
|
+
- Post-deployment smoke tests run before the deployment is complete (`in_progress` run)
|
|
34
|
+
- Notification steps send duplicate Slack/email messages for each status transition
|
|
35
|
+
- Downstream `workflow_run` triggers fire multiple times, causing race conditions
|
|
36
|
+
- GitHub-billed Actions minutes are wasted on unwanted runs
|
|
37
|
+
|
|
38
|
+
The `deployment_status` event does not have sensible defaults for status filtering —
|
|
39
|
+
unlike `pull_request` (which defaults to `opened`, `synchronize`, `reopened`),
|
|
40
|
+
`deployment_status` has no default type filter and fires for everything.
|
|
41
|
+
|
|
42
|
+
Note: This is analogous to `on.pull_request_review` firing for all review types by
|
|
43
|
+
default (documented in triggers-062). Both events require explicit `types:` filters
|
|
44
|
+
to limit scope to meaningful actions.
|
|
45
|
+
fix: |
|
|
46
|
+
Add a `types:` filter to `on.deployment_status` to limit which status transitions
|
|
47
|
+
trigger the workflow. For most use cases:
|
|
48
|
+
- Post-deployment tests: use `types: [success]`
|
|
49
|
+
- Deployment monitoring: use `types: [failure, error]`
|
|
50
|
+
- Full lifecycle tracking: use `types: [in_progress, success, failure, error]`
|
|
51
|
+
|
|
52
|
+
Additionally, add an `if:` condition using `github.event.deployment_status.state`
|
|
53
|
+
for fine-grained control when multiple types are needed.
|
|
54
|
+
fix_code:
|
|
55
|
+
- language: yaml
|
|
56
|
+
label: 'Filter to success only — post-deployment smoke tests'
|
|
57
|
+
code: |
|
|
58
|
+
on:
|
|
59
|
+
deployment_status:
|
|
60
|
+
types:
|
|
61
|
+
- success # Only runs when deployment reaches success state
|
|
62
|
+
|
|
63
|
+
jobs:
|
|
64
|
+
smoke-test:
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
steps:
|
|
67
|
+
- name: Run smoke tests against deployed environment
|
|
68
|
+
run: |
|
|
69
|
+
ENV_URL="${{ github.event.deployment_status.environment_url }}"
|
|
70
|
+
echo "Testing $ENV_URL"
|
|
71
|
+
curl -f "$ENV_URL/health"
|
|
72
|
+
- language: yaml
|
|
73
|
+
label: 'Filter to failure and error — deployment monitoring'
|
|
74
|
+
code: |
|
|
75
|
+
on:
|
|
76
|
+
deployment_status:
|
|
77
|
+
types:
|
|
78
|
+
- failure
|
|
79
|
+
- error
|
|
80
|
+
|
|
81
|
+
jobs:
|
|
82
|
+
alert:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- name: Notify on deployment failure
|
|
86
|
+
run: |
|
|
87
|
+
echo "Deployment failed: ${{ github.event.deployment_status.state }}"
|
|
88
|
+
echo "Environment: ${{ github.event.deployment.environment }}"
|
|
89
|
+
- language: yaml
|
|
90
|
+
label: 'Multiple types with runtime if: check for nuanced handling'
|
|
91
|
+
code: |
|
|
92
|
+
on:
|
|
93
|
+
deployment_status:
|
|
94
|
+
types:
|
|
95
|
+
- success
|
|
96
|
+
- failure
|
|
97
|
+
- error
|
|
98
|
+
|
|
99
|
+
jobs:
|
|
100
|
+
post-deploy:
|
|
101
|
+
runs-on: ubuntu-latest
|
|
102
|
+
steps:
|
|
103
|
+
- name: Run tests on success
|
|
104
|
+
if: github.event.deployment_status.state == 'success'
|
|
105
|
+
run: echo "Running post-deployment tests"
|
|
106
|
+
|
|
107
|
+
- name: Alert on failure
|
|
108
|
+
if: |
|
|
109
|
+
github.event.deployment_status.state == 'failure' ||
|
|
110
|
+
github.event.deployment_status.state == 'error'
|
|
111
|
+
run: echo "Alerting on deployment failure"
|
|
112
|
+
prevention:
|
|
113
|
+
- "Always add `types:` to `on.deployment_status` — the default of no filter fires for all 6 status transitions"
|
|
114
|
+
- "Check `github.event.deployment_status.state` in workflow conditions when using multiple status types"
|
|
115
|
+
- "Use `environment_url` from `github.event.deployment_status` to target the correct environment in post-deployment tests"
|
|
116
|
+
- "Monitor your Actions run history after deploying — multiple runs per deployment indicates a missing types: filter"
|
|
117
|
+
docs:
|
|
118
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#deployment_status'
|
|
119
|
+
label: 'GitHub Docs: deployment_status event — activity types'
|
|
120
|
+
- url: 'https://docs.github.com/en/rest/deployments/statuses?apiVersion=2022-11-28'
|
|
121
|
+
label: 'GitHub REST API: Deployment statuses — state values'
|
|
122
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#github-context'
|
|
123
|
+
label: 'GitHub Docs: github.event.deployment_status context fields'
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
id: yaml-syntax-058
|
|
2
|
+
title: 'on.workflow_call.inputs boolean default must be YAML boolean not a quoted string — default: ''true'' causes validation error'
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- workflow-call
|
|
7
|
+
- reusable-workflow
|
|
8
|
+
- inputs
|
|
9
|
+
- boolean
|
|
10
|
+
- default
|
|
11
|
+
- validation-error
|
|
12
|
+
- type-mismatch
|
|
13
|
+
patterns:
|
|
14
|
+
- regex: 'Unexpected\s+value\s+''true'''
|
|
15
|
+
flags: 'i'
|
|
16
|
+
- regex: 'Unexpected\s+value\s+''false'''
|
|
17
|
+
flags: 'i'
|
|
18
|
+
- regex: 'on\.workflow_call\.inputs\.[^.]+\.default.*''(?:true|false)'''
|
|
19
|
+
flags: 'i'
|
|
20
|
+
- regex: 'default:\s+''(?:true|false)'''
|
|
21
|
+
flags: 'i'
|
|
22
|
+
error_messages:
|
|
23
|
+
- "Invalid workflow file: .github/workflows/deploy.yml: on.workflow_call.inputs.dry_run.default: Unexpected value 'true'"
|
|
24
|
+
- "Unexpected value 'true'"
|
|
25
|
+
- "Unexpected value 'false'"
|
|
26
|
+
- "on.workflow_call.inputs.X.default: Unexpected value 'true'"
|
|
27
|
+
root_cause: |
|
|
28
|
+
In GitHub Actions, `on.workflow_call.inputs` supports three types: `string`, `boolean`,
|
|
29
|
+
and `number`. When declaring a `type: boolean` input, the `default:` value must be
|
|
30
|
+
a YAML boolean literal (`true` or `false`), NOT a quoted string (`'true'` or `'false'`).
|
|
31
|
+
|
|
32
|
+
Quoted strings ('true', 'false') are YAML string scalars. GitHub Actions validates
|
|
33
|
+
the `default:` value against the declared input `type:`, and when a string is given
|
|
34
|
+
where a boolean is expected, workflow validation fails with:
|
|
35
|
+
"on.workflow_call.inputs.X.default: Unexpected value 'true'"
|
|
36
|
+
|
|
37
|
+
This mistake is extremely common for two reasons:
|
|
38
|
+
1. Developers working with YAML often quote boolean-like values defensively to avoid
|
|
39
|
+
YAML parsing surprises — but in this specific field, the quotes cause the error.
|
|
40
|
+
2. The error message "Unexpected value 'true'" is confusing: `true` is expected, but
|
|
41
|
+
the quotes around it in the error output make it look like 'true' is a bad value,
|
|
42
|
+
not that the quotes themselves are the problem.
|
|
43
|
+
|
|
44
|
+
This is distinct from `silent-failures/workflow-call-boolean-input-string-coercion.yml`
|
|
45
|
+
which covers the receiving side: even when defaults are declared correctly, the called
|
|
46
|
+
workflow receives boolean input values as strings ('true'/'false') in the `inputs`
|
|
47
|
+
context and must compare using `== 'true'` not `== true`. This entry is about the
|
|
48
|
+
DECLARATION error before the workflow even runs.
|
|
49
|
+
fix: |
|
|
50
|
+
Remove the quotes from the `default:` value for `type: boolean` inputs in
|
|
51
|
+
`on.workflow_call.inputs`. Use bare YAML booleans `true` and `false`.
|
|
52
|
+
|
|
53
|
+
If you want to document the type explicitly, add a `description:` field instead of
|
|
54
|
+
relying on the default value to communicate the type.
|
|
55
|
+
fix_code:
|
|
56
|
+
- language: yaml
|
|
57
|
+
label: 'WRONG: quoted string default causes validation error'
|
|
58
|
+
code: |
|
|
59
|
+
# BROKEN: 'true' is a string, not a boolean — validation fails
|
|
60
|
+
on:
|
|
61
|
+
workflow_call:
|
|
62
|
+
inputs:
|
|
63
|
+
dry_run:
|
|
64
|
+
type: boolean
|
|
65
|
+
default: 'true' # ERROR: Unexpected value 'true'
|
|
66
|
+
description: 'Run in dry-run mode'
|
|
67
|
+
- language: yaml
|
|
68
|
+
label: 'CORRECT: bare YAML boolean for default value'
|
|
69
|
+
code: |
|
|
70
|
+
# FIXED: true (no quotes) is a YAML boolean — validation passes
|
|
71
|
+
on:
|
|
72
|
+
workflow_call:
|
|
73
|
+
inputs:
|
|
74
|
+
dry_run:
|
|
75
|
+
type: boolean
|
|
76
|
+
default: true # Correct YAML boolean literal
|
|
77
|
+
description: 'Run in dry-run mode (default: enabled)'
|
|
78
|
+
skip_tests:
|
|
79
|
+
type: boolean
|
|
80
|
+
default: false # Correct YAML boolean literal
|
|
81
|
+
description: 'Skip test suite'
|
|
82
|
+
- language: yaml
|
|
83
|
+
label: 'Complete reusable workflow with correct boolean inputs'
|
|
84
|
+
code: |
|
|
85
|
+
# .github/workflows/deploy-reusable.yml
|
|
86
|
+
on:
|
|
87
|
+
workflow_call:
|
|
88
|
+
inputs:
|
|
89
|
+
environment:
|
|
90
|
+
type: string
|
|
91
|
+
required: true
|
|
92
|
+
description: 'Target environment: staging or production'
|
|
93
|
+
dry_run:
|
|
94
|
+
type: boolean
|
|
95
|
+
default: false # bare boolean, no quotes
|
|
96
|
+
description: 'Perform a dry run without making changes'
|
|
97
|
+
notify:
|
|
98
|
+
type: boolean
|
|
99
|
+
default: true # bare boolean, no quotes
|
|
100
|
+
description: 'Send Slack notification on completion'
|
|
101
|
+
|
|
102
|
+
jobs:
|
|
103
|
+
deploy:
|
|
104
|
+
runs-on: ubuntu-latest
|
|
105
|
+
steps:
|
|
106
|
+
- uses: actions/checkout@v4
|
|
107
|
+
# Note: inputs.dry_run arrives as the STRING 'true' or 'false'
|
|
108
|
+
# in the job body — compare with == 'true', not == true
|
|
109
|
+
- if: inputs.dry_run != 'true'
|
|
110
|
+
run: echo "Deploying to ${{ inputs.environment }}"
|
|
111
|
+
prevention:
|
|
112
|
+
- "Never quote boolean default values in workflow_call inputs — use bare `true` or `false`"
|
|
113
|
+
- "Remember that while the DECLARATION requires bare booleans, the VALUE received by steps is always a string: compare with `== 'true'`, not `== true`"
|
|
114
|
+
- "Run `actionlint` locally to catch input type/default mismatches before pushing"
|
|
115
|
+
- "Validate workflow files with `gh workflow view` or push to a test branch to surface validation errors early"
|
|
116
|
+
docs:
|
|
117
|
+
- url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_call'
|
|
118
|
+
label: 'GitHub Docs: workflow_call inputs — supported types and default values'
|
|
119
|
+
- url: 'https://docs.github.com/en/actions/sharing-automations/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow'
|
|
120
|
+
label: 'GitHub Docs: Reusable workflow inputs'
|
|
121
|
+
- url: 'https://github.com/orgs/community/discussions/39357'
|
|
122
|
+
label: 'GitHub Community: workflow_call input type validation discussion'
|
package/package.json
CHANGED