@htekdev/actions-debugger 1.0.0
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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/db/loader.d.ts +12 -0
- package/dist/db/loader.d.ts.map +1 -0
- package/dist/db/loader.js +76 -0
- package/dist/db/loader.js.map +1 -0
- package/dist/db/search.d.ts +19 -0
- package/dist/db/search.d.ts.map +1 -0
- package/dist/db/search.js +123 -0
- package/dist/db/search.js.map +1 -0
- package/dist/db/types.d.ts +61 -0
- package/dist/db/types.d.ts.map +1 -0
- package/dist/db/types.js +5 -0
- package/dist/db/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +164 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/diagnose-workflow.d.ts +13 -0
- package/dist/tools/diagnose-workflow.d.ts.map +1 -0
- package/dist/tools/diagnose-workflow.js +53 -0
- package/dist/tools/diagnose-workflow.js.map +1 -0
- package/dist/tools/list-categories.d.ts +13 -0
- package/dist/tools/list-categories.d.ts.map +1 -0
- package/dist/tools/list-categories.js +51 -0
- package/dist/tools/list-categories.js.map +1 -0
- package/dist/tools/lookup-error.d.ts +18 -0
- package/dist/tools/lookup-error.d.ts.map +1 -0
- package/dist/tools/lookup-error.js +67 -0
- package/dist/tools/lookup-error.js.map +1 -0
- package/dist/tools/search-errors.d.ts +17 -0
- package/dist/tools/search-errors.d.ts.map +1 -0
- package/dist/tools/search-errors.js +33 -0
- package/dist/tools/search-errors.js.map +1 -0
- package/dist/tools/suggest-fix.d.ts +13 -0
- package/dist/tools/suggest-fix.d.ts.map +1 -0
- package/dist/tools/suggest-fix.js +62 -0
- package/dist/tools/suggest-fix.js.map +1 -0
- package/dist/utils/pattern-matcher.d.ts +15 -0
- package/dist/utils/pattern-matcher.d.ts.map +1 -0
- package/dist/utils/pattern-matcher.js +50 -0
- package/dist/utils/pattern-matcher.js.map +1 -0
- package/dist/utils/yaml-parser.d.ts +10 -0
- package/dist/utils/yaml-parser.d.ts.map +1 -0
- package/dist/utils/yaml-parser.js +142 -0
- package/dist/utils/yaml-parser.js.map +1 -0
- package/errors/_schema.json +89 -0
- package/errors/caching-artifacts/cache-miss.yml +56 -0
- package/errors/caching-artifacts/upload-artifact-v4-breaking.yml +67 -0
- package/errors/concurrency-timing/jobs-cancelled-unexpectedly.yml +60 -0
- package/errors/known-unsolved/no-step-retry.yml +53 -0
- package/errors/permissions-auth/github-token-403.yml +64 -0
- package/errors/permissions-auth/oidc-aws-failure.yml +85 -0
- package/errors/runner-environment/disk-space.yml +57 -0
- package/errors/runner-environment/node-runtime-deprecation.yml +56 -0
- package/errors/silent-failures/github-token-no-trigger.yml +57 -0
- package/errors/silent-failures/scheduled-workflow-disabled.yml +59 -0
- package/errors/triggers/cron-schedule-late.yml +59 -0
- package/errors/triggers/workflow-not-triggering.yml +60 -0
- package/errors/yaml-syntax/if-always-true.yml +52 -0
- package/errors/yaml-syntax/secrets-in-if.yml +55 -0
- package/errors/yaml-syntax/unexpected-yaml-key.yml +69 -0
- package/package.json +67 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
id: runner-environment-002
|
|
2
|
+
title: "Runner Out of Disk Space"
|
|
3
|
+
category: runner-environment
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- runner
|
|
7
|
+
- disk-space
|
|
8
|
+
- docker
|
|
9
|
+
- enospc
|
|
10
|
+
- ubuntu-latest
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "No space left on device"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "ENOSPC"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "write .+ no space left on device"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "No space left on device"
|
|
20
|
+
- "ENOSPC: no space left on device"
|
|
21
|
+
root_cause: |
|
|
22
|
+
GitHub-hosted runners have finite disk space, and large Docker layers, Android SDKs,
|
|
23
|
+
toolchains, browser caches, or build artifacts can exhaust it mid-job. This frequently
|
|
24
|
+
shows up on `ubuntu-latest` when workflows build containers or multiple large targets.
|
|
25
|
+
|
|
26
|
+
The underlying job logic may be correct, but the runner image simply runs out of storage.
|
|
27
|
+
fix: |
|
|
28
|
+
Free disk space early in the job, reduce artifact retention, and avoid downloading heavy
|
|
29
|
+
toolchains you do not need. If the workload is consistently too large, move the job to a
|
|
30
|
+
larger runner or split the build across jobs.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Free disk space before heavy build steps"
|
|
34
|
+
code: |
|
|
35
|
+
jobs:
|
|
36
|
+
build:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: jlumbroso/free-disk-space@v1
|
|
41
|
+
with:
|
|
42
|
+
large-packages: true
|
|
43
|
+
docker-images: true
|
|
44
|
+
tool-cache: false
|
|
45
|
+
- run: docker build -t app .
|
|
46
|
+
prevention:
|
|
47
|
+
- "Measure disk usage before and after large build steps with `df -h`."
|
|
48
|
+
- "Delete temporary artifacts and caches you do not need inside the job."
|
|
49
|
+
- "Avoid monolithic jobs that build every target on one runner."
|
|
50
|
+
docs:
|
|
51
|
+
- url: "https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners"
|
|
52
|
+
label: "About GitHub-hosted runners"
|
|
53
|
+
- url: "https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
|
|
54
|
+
label: "Choosing the runner for a job"
|
|
55
|
+
source:
|
|
56
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
57
|
+
section: "Runner disk space exhaustion"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
id: runner-environment-009
|
|
2
|
+
title: "Node.js Runtime Deprecation"
|
|
3
|
+
category: runner-environment
|
|
4
|
+
severity: warning
|
|
5
|
+
tags:
|
|
6
|
+
- node
|
|
7
|
+
- runtime
|
|
8
|
+
- deprecation
|
|
9
|
+
- marketplace-actions
|
|
10
|
+
- compatibility
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "Node\\.js 16 actions are deprecated"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "Please update the following actions to use Node\\.js 20"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "runs using Node 16 are deprecated"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Node.js 16 actions are deprecated."
|
|
20
|
+
- "Please update the following actions to use Node.js 20."
|
|
21
|
+
root_cause: |
|
|
22
|
+
Some marketplace actions bundle a Node.js runtime. When GitHub deprecates an older
|
|
23
|
+
runtime such as Node 16, workflows can start emitting warnings or eventually fail if the
|
|
24
|
+
referenced action version has not been updated.
|
|
25
|
+
|
|
26
|
+
This is usually caused by pinning an old major version of an action long after the runner
|
|
27
|
+
platform has moved on.
|
|
28
|
+
fix: |
|
|
29
|
+
Upgrade the affected action to a maintained version that uses the current supported Node
|
|
30
|
+
runtime. Review pinned SHAs and major versions for checkout, setup, artifact, and cache
|
|
31
|
+
actions first because they are common sources of these warnings.
|
|
32
|
+
fix_code:
|
|
33
|
+
- language: yaml
|
|
34
|
+
label: "Upgrade action versions to Node 20-compatible releases"
|
|
35
|
+
code: |
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
- uses: actions/setup-node@v4
|
|
39
|
+
with:
|
|
40
|
+
node-version: 20
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: build-output
|
|
44
|
+
path: dist/
|
|
45
|
+
prevention:
|
|
46
|
+
- "Review GitHub Actions deprecation notices and keep marketplace action versions current."
|
|
47
|
+
- "Prefer supported major versions from official `actions/*` repositories."
|
|
48
|
+
- "Audit pinned SHAs periodically so old runtimes do not linger unnoticed."
|
|
49
|
+
docs:
|
|
50
|
+
- url: "https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions"
|
|
51
|
+
label: "JavaScript action runtime metadata"
|
|
52
|
+
- url: "https://docs.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions"
|
|
53
|
+
label: "Metadata syntax for GitHub Actions"
|
|
54
|
+
source:
|
|
55
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
56
|
+
section: "Node runtime deprecation warnings"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
id: silent-failures-002
|
|
2
|
+
title: "GITHUB_TOKEN Cannot Trigger Downstream Workflows"
|
|
3
|
+
category: silent-failures
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- github-token
|
|
7
|
+
- triggers
|
|
8
|
+
- downstream
|
|
9
|
+
- workflow-chain
|
|
10
|
+
- authentication
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "events triggered by the GITHUB_TOKEN.*will not create a new workflow run"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "github-actions\\[bot\\]"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "GITHUB_TOKEN"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Events triggered by the GITHUB_TOKEN will not create a new workflow run."
|
|
20
|
+
root_cause: |
|
|
21
|
+
Commits, tags, and releases created with the repository `GITHUB_TOKEN` are intentionally
|
|
22
|
+
prevented from triggering most downstream workflows. This is a platform safety feature to
|
|
23
|
+
stop accidental recursion and workflow loops.
|
|
24
|
+
|
|
25
|
+
The upstream workflow appears to succeed, but the dependent workflow never starts, which
|
|
26
|
+
makes this feel like a silent trigger failure.
|
|
27
|
+
fix: |
|
|
28
|
+
Use a GitHub App installation token or a PAT when you intentionally need one workflow to
|
|
29
|
+
trigger another via `push`, `create`, or `release`. Keep `GITHUB_TOKEN` for normal repo
|
|
30
|
+
automation that should not fan out into new workflow runs.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Use a non-GITHUB_TOKEN credential for recursive automation"
|
|
34
|
+
code: |
|
|
35
|
+
jobs:
|
|
36
|
+
release:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- name: Create tag with a PAT
|
|
41
|
+
env:
|
|
42
|
+
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
|
|
43
|
+
run: |
|
|
44
|
+
git tag v${{ github.run_number }}
|
|
45
|
+
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git --tags
|
|
46
|
+
prevention:
|
|
47
|
+
- "Assume `GITHUB_TOKEN` will not fan out into downstream workflow runs unless you are using `workflow_dispatch` or `repository_dispatch`."
|
|
48
|
+
- "Document which automations require a GitHub App token or PAT."
|
|
49
|
+
- "Avoid recursive workflow designs that depend on implicit `push` triggers from `github-actions[bot]`."
|
|
50
|
+
docs:
|
|
51
|
+
- url: "https://docs.github.com/en/actions/security-guides/automatic-token-authentication"
|
|
52
|
+
label: "Automatic token authentication"
|
|
53
|
+
- url: "https://docs.github.com/en/actions/reference/events-that-trigger-workflows"
|
|
54
|
+
label: "Events that trigger workflows"
|
|
55
|
+
source:
|
|
56
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
57
|
+
section: "GITHUB_TOKEN downstream trigger limitations"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
id: silent-failures-001
|
|
2
|
+
title: "Scheduled Workflows Silently Disabled After 60 Days"
|
|
3
|
+
category: silent-failures
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- schedule
|
|
7
|
+
- cron
|
|
8
|
+
- inactivity
|
|
9
|
+
- disabled
|
|
10
|
+
- automation
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "This scheduled workflow is disabled because there hasn't been activity in this repository for at least 60 days"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "schedule.*workflow.*disabled"
|
|
15
|
+
flags: "i"
|
|
16
|
+
error_messages:
|
|
17
|
+
- "This scheduled workflow is disabled because there hasn't been activity in this repository for at least 60 days"
|
|
18
|
+
root_cause: |
|
|
19
|
+
In public repositories, GitHub automatically disables scheduled workflows after about
|
|
20
|
+
60 days with no repository activity. Nothing in the workflow YAML is technically wrong,
|
|
21
|
+
but the cron job stops firing until someone re-enables it or new activity occurs.
|
|
22
|
+
|
|
23
|
+
This feels like a silent failure because the expected schedule disappears rather than
|
|
24
|
+
producing a normal failed run.
|
|
25
|
+
fix: |
|
|
26
|
+
Re-enable the workflow in the Actions UI and keep the repository active. If the schedule
|
|
27
|
+
must stay alive in a low-activity repository, add a keepalive workflow that periodically
|
|
28
|
+
creates harmless activity.
|
|
29
|
+
fix_code:
|
|
30
|
+
- language: yaml
|
|
31
|
+
label: "Keep scheduled workflows active"
|
|
32
|
+
code: |
|
|
33
|
+
name: Keepalive
|
|
34
|
+
|
|
35
|
+
on:
|
|
36
|
+
schedule:
|
|
37
|
+
- cron: '0 6 * * 1'
|
|
38
|
+
workflow_dispatch:
|
|
39
|
+
|
|
40
|
+
jobs:
|
|
41
|
+
keepalive:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: gautamkrishnar/keepalive-workflow@v2
|
|
45
|
+
with:
|
|
46
|
+
committer_username: github-actions[bot]
|
|
47
|
+
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
|
|
48
|
+
prevention:
|
|
49
|
+
- "Check the Actions tab periodically for disabled scheduled workflows in low-activity repositories."
|
|
50
|
+
- "Pair important cron automations with `workflow_dispatch` for manual recovery."
|
|
51
|
+
- "Use a keepalive strategy for public repos that rely on unattended schedules."
|
|
52
|
+
docs:
|
|
53
|
+
- url: "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule"
|
|
54
|
+
label: "schedule event"
|
|
55
|
+
- url: "https://docs.github.com/en/actions/managing-workflow-runs/disabling-and-enabling-a-workflow"
|
|
56
|
+
label: "Disable and enable a workflow"
|
|
57
|
+
source:
|
|
58
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
59
|
+
section: "Scheduled workflows disabled after inactivity"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
id: triggers-003
|
|
2
|
+
title: "Cron Schedule Running Late or Not Running"
|
|
3
|
+
category: triggers
|
|
4
|
+
severity: warning
|
|
5
|
+
tags:
|
|
6
|
+
- cron
|
|
7
|
+
- schedule
|
|
8
|
+
- delay
|
|
9
|
+
- forks
|
|
10
|
+
- best-effort
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "schedule"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "Delayed"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "This event will only trigger a workflow run if the workflow file exists on the default branch"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Scheduled workflows can be delayed during periods of high loads of GitHub Actions workflow runs."
|
|
20
|
+
root_cause: |
|
|
21
|
+
GitHub Actions cron is best-effort, not real-time scheduling. During peak usage windows,
|
|
22
|
+
scheduled workflows can start 15 to 45 minutes late. In forks, scheduled workflows are also
|
|
23
|
+
disabled by default, so a copied workflow may never run until someone explicitly enables it.
|
|
24
|
+
|
|
25
|
+
The YAML can be correct and the repository can still see timing drift because the platform
|
|
26
|
+
does not guarantee precise minute-by-minute execution.
|
|
27
|
+
fix: |
|
|
28
|
+
Treat cron timing as approximate. Schedule important automations away from the top of the
|
|
29
|
+
hour, add tolerance for startup drift, and provide a `workflow_dispatch` fallback for jobs
|
|
30
|
+
that sometimes need manual recovery.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Add jitter-friendly scheduling and manual fallback"
|
|
34
|
+
code: |
|
|
35
|
+
name: Nightly maintenance
|
|
36
|
+
|
|
37
|
+
on:
|
|
38
|
+
schedule:
|
|
39
|
+
- cron: '17 3 * * *'
|
|
40
|
+
workflow_dispatch:
|
|
41
|
+
|
|
42
|
+
jobs:
|
|
43
|
+
maintain:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- run: ./scripts/maintenance.sh
|
|
48
|
+
prevention:
|
|
49
|
+
- "Avoid scheduling critical jobs exactly at minute 0 because that is a common contention window."
|
|
50
|
+
- "Use external monitoring if a schedule must be near-real-time."
|
|
51
|
+
- "Enable scheduled workflows manually after creating a fork or after long inactivity."
|
|
52
|
+
docs:
|
|
53
|
+
- url: "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule"
|
|
54
|
+
label: "schedule event"
|
|
55
|
+
- url: "https://docs.github.com/en/actions/managing-workflow-runs/disabling-and-enabling-a-workflow"
|
|
56
|
+
label: "Disable and enable a workflow"
|
|
57
|
+
source:
|
|
58
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
59
|
+
section: "Cron schedules running late"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
id: triggers-001
|
|
2
|
+
title: "Workflow Not Triggering At All"
|
|
3
|
+
category: triggers
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- triggers
|
|
7
|
+
- workflow-file
|
|
8
|
+
- default-branch
|
|
9
|
+
- on
|
|
10
|
+
- events
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "This event will only trigger a workflow run if the workflow file exists on the default branch"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "Workflow file .* not found on the default branch"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "No runs found for this workflow"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "This event will only trigger a workflow run if the workflow file exists on the default branch"
|
|
20
|
+
root_cause: |
|
|
21
|
+
Some events only trigger if the workflow file itself exists on the repository's default
|
|
22
|
+
branch. A workflow can look perfectly valid in a feature branch, but GitHub will ignore it
|
|
23
|
+
for certain event types until the file is present on the default branch with correct `on:`
|
|
24
|
+
syntax and placement under `.github/workflows/`.
|
|
25
|
+
|
|
26
|
+
A wrong indentation level under `on:`, a typo in the event name, or putting the file in the
|
|
27
|
+
wrong directory can create the same symptom: nothing runs.
|
|
28
|
+
fix: |
|
|
29
|
+
Confirm the workflow file lives in `.github/workflows/`, validate the `on:` block, and make
|
|
30
|
+
sure the workflow file already exists on the default branch for the event you expect to fire.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Use valid workflow location and trigger syntax"
|
|
34
|
+
code: |
|
|
35
|
+
name: CI
|
|
36
|
+
|
|
37
|
+
on:
|
|
38
|
+
push:
|
|
39
|
+
branches:
|
|
40
|
+
- main
|
|
41
|
+
pull_request:
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
test:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
- run: npm test
|
|
49
|
+
prevention:
|
|
50
|
+
- "Keep workflow files only under `.github/workflows/`."
|
|
51
|
+
- "Merge new workflow files to the default branch before relying on events like `schedule` or `workflow_dispatch`."
|
|
52
|
+
- "Validate event names and indentation in every `on:` block."
|
|
53
|
+
docs:
|
|
54
|
+
- url: "https://docs.github.com/en/actions/reference/events-that-trigger-workflows"
|
|
55
|
+
label: "Events that trigger workflows"
|
|
56
|
+
- url: "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions"
|
|
57
|
+
label: "Workflow syntax for GitHub Actions"
|
|
58
|
+
source:
|
|
59
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
60
|
+
section: "Workflow not triggering"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
id: yaml-syntax-007
|
|
2
|
+
title: "if: Conditionals Always Evaluating to true"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- if
|
|
7
|
+
- expressions
|
|
8
|
+
- conditionals
|
|
9
|
+
- yaml
|
|
10
|
+
- truthy
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "Evaluating condition for step: .*"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "Expanded: '.+\\n.+"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "Result: true"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Result: true"
|
|
20
|
+
root_cause: |
|
|
21
|
+
Using a block scalar such as `if: |` turns the condition into a multi-line string.
|
|
22
|
+
In GitHub Actions expressions, any non-empty string is truthy, so the step or job can
|
|
23
|
+
run even when the intended logical check should have been false.
|
|
24
|
+
|
|
25
|
+
A similar footgun happens when the expression is written with extra trailing text or
|
|
26
|
+
whitespace outside the `${{ }}` block, which changes the value from a boolean expression
|
|
27
|
+
into a plain string.
|
|
28
|
+
fix: |
|
|
29
|
+
Keep `if:` expressions on a single line and avoid YAML pipe scalars for conditionals.
|
|
30
|
+
Make sure the entire value is the expression itself, with no extra text after `${{ }}`.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Write if as a single-line expression"
|
|
34
|
+
code: |
|
|
35
|
+
jobs:
|
|
36
|
+
deploy:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
39
|
+
steps:
|
|
40
|
+
- run: ./deploy.sh
|
|
41
|
+
prevention:
|
|
42
|
+
- "Never use `if: |` for GitHub Actions conditionals."
|
|
43
|
+
- "Turn on step debug logging when a condition seems inverted and inspect the `Expanded:` and `Result:` lines."
|
|
44
|
+
- "Keep boolean logic entirely inside a single `${{ }}` expression."
|
|
45
|
+
docs:
|
|
46
|
+
- url: "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif"
|
|
47
|
+
label: "jobs.<job_id>.if"
|
|
48
|
+
- url: "https://docs.github.com/en/actions/learn-github-actions/expressions"
|
|
49
|
+
label: "Expressions"
|
|
50
|
+
source:
|
|
51
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
52
|
+
section: "if expressions that always evaluate true"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
id: yaml-syntax-005
|
|
2
|
+
title: "secrets.* in if: Conditions — Silent Failures"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- secrets
|
|
7
|
+
- if
|
|
8
|
+
- expressions
|
|
9
|
+
- contexts
|
|
10
|
+
- env
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "Unrecognized named-value: 'secrets'"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "The workflow is not valid\\..*named-value: 'secrets'"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "Context access might be invalid: secrets\\."
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Unrecognized named-value: 'secrets'"
|
|
20
|
+
root_cause: |
|
|
21
|
+
The `secrets` context is not available everywhere an expression can appear, and using
|
|
22
|
+
`secrets.*` directly inside an `if:` condition is a common trap. Depending on where the
|
|
23
|
+
expression is evaluated, GitHub Actions can reject the workflow or effectively treat the
|
|
24
|
+
check as unavailable.
|
|
25
|
+
|
|
26
|
+
The safe pattern is to map the secret into an environment variable first, then evaluate
|
|
27
|
+
the environment variable in the `if:` expression.
|
|
28
|
+
fix: |
|
|
29
|
+
Pass the secret through `env:` and reference `env.NAME` in the `if:`. This keeps the
|
|
30
|
+
conditional supported and avoids direct `secrets.*` access in the condition.
|
|
31
|
+
fix_code:
|
|
32
|
+
- language: yaml
|
|
33
|
+
label: "Gate a step using env instead of secrets directly"
|
|
34
|
+
code: |
|
|
35
|
+
jobs:
|
|
36
|
+
publish:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
env:
|
|
39
|
+
HAS_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
40
|
+
steps:
|
|
41
|
+
- name: Publish
|
|
42
|
+
if: ${{ env.HAS_TOKEN != '' }}
|
|
43
|
+
run: npm publish
|
|
44
|
+
prevention:
|
|
45
|
+
- "Do not reference `secrets.*` directly in `if:` unless the docs explicitly allow that context."
|
|
46
|
+
- "Promote secrets into `env` when a step should be conditionally gated."
|
|
47
|
+
- "Check the contexts reference before using a context in expressions."
|
|
48
|
+
docs:
|
|
49
|
+
- url: "https://docs.github.com/en/actions/learn-github-actions/contexts"
|
|
50
|
+
label: "Contexts"
|
|
51
|
+
- url: "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsif"
|
|
52
|
+
label: "jobs.<job_id>.steps[*].if"
|
|
53
|
+
source:
|
|
54
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
55
|
+
section: "Secrets in if conditions"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
id: yaml-syntax-001
|
|
2
|
+
title: "Unexpected or Typo'd YAML Keys"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- yaml
|
|
7
|
+
- syntax
|
|
8
|
+
- validation
|
|
9
|
+
- keys
|
|
10
|
+
- typos
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "Unexpected value '\\w+'"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "unexpected key \"\\w+\" for step"
|
|
15
|
+
flags: "i"
|
|
16
|
+
- regex: "The workflow is not valid\\..*Unexpected value '\\w+'"
|
|
17
|
+
flags: "i"
|
|
18
|
+
error_messages:
|
|
19
|
+
- "Unexpected value 'default'"
|
|
20
|
+
- "Unexpected value 'Shell'"
|
|
21
|
+
- "Unexpected value 'branch'"
|
|
22
|
+
root_cause: |
|
|
23
|
+
GitHub Actions workflow keys are schema-validated and case-sensitive. A typo like
|
|
24
|
+
`default:` instead of `defaults:`, `Shell:` instead of `shell:`, or `branch:` instead
|
|
25
|
+
of `branches:` is treated as an unknown key and the workflow is rejected before it runs.
|
|
26
|
+
|
|
27
|
+
This usually happens when copying snippets from memory or mixing YAML conventions from
|
|
28
|
+
other tools into GitHub Actions syntax.
|
|
29
|
+
fix: |
|
|
30
|
+
Replace the invalid key with the exact schema-supported key name. Double-check plural
|
|
31
|
+
forms and casing against the workflow syntax reference.
|
|
32
|
+
|
|
33
|
+
Common fixes:
|
|
34
|
+
- `default:` -> `defaults:`
|
|
35
|
+
- `Shell:` -> `shell:`
|
|
36
|
+
- `branch:` -> `branches:`
|
|
37
|
+
fix_code:
|
|
38
|
+
- language: yaml
|
|
39
|
+
label: "Use valid GitHub Actions keys"
|
|
40
|
+
code: |
|
|
41
|
+
name: CI
|
|
42
|
+
|
|
43
|
+
on:
|
|
44
|
+
push:
|
|
45
|
+
branches:
|
|
46
|
+
- main
|
|
47
|
+
|
|
48
|
+
defaults:
|
|
49
|
+
run:
|
|
50
|
+
shell: bash
|
|
51
|
+
|
|
52
|
+
jobs:
|
|
53
|
+
test:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- run: npm test
|
|
58
|
+
prevention:
|
|
59
|
+
- "Validate workflow files against the GitHub Actions workflow syntax docs before committing."
|
|
60
|
+
- "Prefer editing from working examples instead of typing keys from memory."
|
|
61
|
+
- "Use code review checks for `defaults`, `shell`, and `branches` because those typos are common."
|
|
62
|
+
docs:
|
|
63
|
+
- url: "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions"
|
|
64
|
+
label: "Workflow syntax for GitHub Actions"
|
|
65
|
+
- url: "https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions"
|
|
66
|
+
label: "Understanding GitHub Actions"
|
|
67
|
+
source:
|
|
68
|
+
article: "https://htek.dev/articles/github-actions-debugging-guide"
|
|
69
|
+
section: "YAML validation and typo'd keys"
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@htekdev/actions-debugger",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "65+ real GitHub Actions errors, queryable by agents. MCP server + Copilot skills + error database.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"actions-debugger": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"errors",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"lint": "tsc --noEmit",
|
|
29
|
+
"validate-errors": "node --import tsx scripts/validate-errors.ts",
|
|
30
|
+
"start": "node dist/index.js",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"github-actions",
|
|
35
|
+
"debugging",
|
|
36
|
+
"mcp",
|
|
37
|
+
"model-context-protocol",
|
|
38
|
+
"copilot",
|
|
39
|
+
"ci-cd",
|
|
40
|
+
"error-database"
|
|
41
|
+
],
|
|
42
|
+
"author": "Hector Flores <hector.flores@htek.dev> (https://htek.dev)",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/htekdev/actions-debugger.git"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://htek.dev/articles/github-actions-debugging-guide",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/htekdev/actions-debugger/issues"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
54
|
+
"glob": "^11.0.0",
|
|
55
|
+
"js-yaml": "^4.1.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/js-yaml": "^4.0.9",
|
|
59
|
+
"@types/node": "^22.0.0",
|
|
60
|
+
"tsx": "^4.19.0",
|
|
61
|
+
"typescript": "^5.7.0",
|
|
62
|
+
"vitest": "^3.0.0"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=20.0.0"
|
|
66
|
+
}
|
|
67
|
+
}
|