@htekdev/actions-debugger 1.0.22 → 1.0.24
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/artifact-minimum-retention-one-day.yml +153 -0
- package/errors/caching-artifacts/cache-api-propagation-delay-post-save.yml +128 -0
- package/errors/caching-artifacts/cache-backend-internal-error-skipped.yml +75 -0
- package/errors/caching-artifacts/cache-hit-step-id-case-sensitive-mismatch.yml +95 -0
- package/errors/caching-artifacts/cache-save-post-step-skipped-on-failure.yml +114 -0
- package/errors/concurrency-timing/deploy-pages-in-progress-deployment-wedged.yml +70 -0
- package/errors/concurrency-timing/deployment-review-timeout-expired.yml +88 -0
- package/errors/concurrency-timing/job-concurrency-scope-per-run-not-global.yml +81 -0
- package/errors/concurrency-timing/merge-queue-concurrency-cancel-blocks-all.yml +86 -0
- package/errors/concurrency-timing/reusable-workflow-github-workflow-context-cancel.yml +124 -0
- package/errors/concurrency-timing/runner-scale-set-jobs-never-start.yml +123 -0
- package/errors/concurrency-timing/runner-temp-dir-race-concurrent-workers.yml +90 -0
- package/errors/known-unsolved/artifact-download-url-unauthenticated-404.yml +98 -0
- package/errors/known-unsolved/checkout-v6-credentials-docker-run-manual.yml +105 -0
- package/errors/known-unsolved/concurrency-groups-repo-scoped-only.yml +138 -0
- package/errors/known-unsolved/matrix-256-job-limit.yml +142 -0
- package/errors/known-unsolved/merge-group-paths-filter-not-supported.yml +137 -0
- package/errors/known-unsolved/no-job-allow-failure.yml +73 -0
- package/errors/known-unsolved/reusable-secrets-inherit-not-deep-forwarded.yml +113 -0
- package/errors/known-unsolved/schedule-cron-hours-long-queue-drift.yml +101 -0
- package/errors/permissions-auth/checkout-persist-credentials-token-write.yml +90 -0
- package/errors/permissions-auth/create-github-app-token-cross-job-token-revoked.yml +95 -0
- package/errors/permissions-auth/github-token-contents-write-missing-git-push.yml +117 -0
- package/errors/permissions-auth/org-actions-policy-blocks-unapproved-action.yml +106 -0
- package/errors/runner-environment/codeql-action-v2-deprecated.yml +110 -0
- package/errors/runner-environment/macos-26-openssl-3-system-library-breaking.yml +114 -0
- package/errors/runner-environment/macos-26-ruby-34-default-upgrade.yml +114 -0
- package/errors/runner-environment/macos-26-xcode-default-265-pin-required.yml +99 -0
- package/errors/runner-environment/macos-latest-label-switches-to-macos26.yml +127 -0
- package/errors/runner-environment/node20-removed-toolcache-default-node22.yml +104 -0
- package/errors/runner-environment/org-runner-group-dispatch-null.yml +102 -0
- package/errors/runner-environment/powershell-74-76-threadjob-module-rename.yml +124 -0
- package/errors/runner-environment/self-hosted-runner-not-found.yml +134 -0
- package/errors/runner-environment/self-hosted-runner-selinux-service-exec-failure.yml +116 -0
- package/errors/runner-environment/service-container-no-healthcheck.yml +158 -0
- package/errors/runner-environment/setup-node-v5-corepack-pnpm-not-found.yml +101 -0
- package/errors/runner-environment/setup-node-yarn-not-installed-self-hosted.yml +76 -0
- package/errors/runner-environment/setup-python-externally-managed-env-error.yml +95 -0
- package/errors/runner-environment/windows-2019-runner-retired-june2025.yml +118 -0
- package/errors/runner-environment/windows-2022-docker-daemon-not-started.yml +108 -0
- package/errors/silent-failures/cache-hit-output-string-not-boolean.yml +96 -0
- package/errors/silent-failures/checkout-lfs-pointer-not-content.yml +105 -0
- package/errors/silent-failures/reusable-workflow-output-skipped-contains-secret.yml +115 -0
- package/errors/silent-failures/setup-node-silent-download-exit-zero.yml +105 -0
- package/errors/silent-failures/setup-python-truncated-manifest-silent-exit.yml +111 -0
- package/errors/silent-failures/undefined-env-expression-empty-string-silent.yml +115 -0
- package/errors/silent-failures/windows-powershell-github-output-bash-syntax.yml +118 -0
- package/errors/triggers/fork-pr-first-time-contributor-approval-required.yml +142 -0
- package/errors/triggers/on-push-branches-glob-star-no-slash-match.yml +78 -0
- package/errors/triggers/pull-request-target-env-protection-default-branch-eval.yml +117 -0
- package/errors/triggers/required-status-check-renamed-never-passes.yml +87 -0
- package/errors/triggers/schedule-cron-self-hosted-runner-not-triggered.yml +107 -0
- package/errors/triggers/workflow-run-checkout-uses-default-branch.yml +114 -0
- package/errors/yaml-syntax/composite-action-run-shell-missing.yml +90 -0
- package/errors/yaml-syntax/composite-action-secrets-context-unavailable.yml +99 -0
- package/errors/yaml-syntax/github-script-octokit-renamed-to-github.yml +130 -0
- package/errors/yaml-syntax/labeler-v5-config-format-breaking.yml +67 -0
- package/errors/yaml-syntax/reusable-workflow-nesting-depth-exceeded.yml +113 -0
- package/errors/yaml-syntax/runs-on-expression-array-syntax-error.yml +121 -0
- package/errors/yaml-syntax/setup-go-matrix-version-float-coercion.yml +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
id: triggers-019
|
|
2
|
+
title: "workflow_run-Triggered Job Checks Out Default Branch, Not the Triggering PR's Branch"
|
|
3
|
+
category: triggers
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- workflow_run
|
|
7
|
+
- checkout
|
|
8
|
+
- default-branch
|
|
9
|
+
- silent-failure
|
|
10
|
+
- pull-request
|
|
11
|
+
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: "workflow_run.*head_branch"
|
|
14
|
+
flags: "i"
|
|
15
|
+
- regex: "github\\.event\\.workflow_run\\.head_branch"
|
|
16
|
+
flags: "i"
|
|
17
|
+
|
|
18
|
+
error_messages:
|
|
19
|
+
- "# No error message — the job silently runs against the wrong branch (e.g., main instead of the PR's feature branch)"
|
|
20
|
+
- "HEAD is now at <main-branch-commit> — expected feature branch content not present"
|
|
21
|
+
|
|
22
|
+
root_cause: |
|
|
23
|
+
When a workflow is triggered via `workflow_run`, the triggered workflow ALWAYS
|
|
24
|
+
runs in the context of the repository's DEFAULT branch, not the branch that
|
|
25
|
+
caused the original workflow to run.
|
|
26
|
+
|
|
27
|
+
This means that `actions/checkout` without an explicit `ref:` will check out
|
|
28
|
+
the default branch (e.g., `main`), even when the triggering workflow ran on a
|
|
29
|
+
feature branch or PR. The job may silently pass because it's testing old code
|
|
30
|
+
on `main` rather than the developer's new changes.
|
|
31
|
+
|
|
32
|
+
This is by design: `workflow_run` is intended for privileged workflows that
|
|
33
|
+
run in the base repository context regardless of where the triggering push came
|
|
34
|
+
from. It avoids giving fork PRs access to secrets — but it also means the
|
|
35
|
+
checkout behavior surprises developers expecting to test branch code.
|
|
36
|
+
|
|
37
|
+
The branch of the triggering workflow IS available via the event context:
|
|
38
|
+
`github.event.workflow_run.head_branch`
|
|
39
|
+
`github.event.workflow_run.head_sha`
|
|
40
|
+
|
|
41
|
+
fix: |
|
|
42
|
+
Explicitly set the `ref:` in your `actions/checkout` step to the triggering
|
|
43
|
+
workflow's head commit SHA or branch name.
|
|
44
|
+
|
|
45
|
+
Use `head_sha` (not `head_branch`) for more precise pinning — branch names
|
|
46
|
+
can advance between trigger and checkout for busy repositories.
|
|
47
|
+
|
|
48
|
+
fix_code:
|
|
49
|
+
- language: yaml
|
|
50
|
+
label: "Checkout the triggering workflow's exact commit"
|
|
51
|
+
code: |
|
|
52
|
+
on:
|
|
53
|
+
workflow_run:
|
|
54
|
+
workflows: ["CI — Unit Tests"]
|
|
55
|
+
types: [completed]
|
|
56
|
+
|
|
57
|
+
jobs:
|
|
58
|
+
deploy:
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
with:
|
|
64
|
+
# Use head_sha for precise pinning — not head_branch
|
|
65
|
+
ref: ${{ github.event.workflow_run.head_sha }}
|
|
66
|
+
|
|
67
|
+
- language: yaml
|
|
68
|
+
label: "Download artifacts from the triggering workflow run instead of re-checking out"
|
|
69
|
+
code: |
|
|
70
|
+
# For deployment workflows, prefer downloading the build artifact
|
|
71
|
+
# from the triggering run rather than re-building from source.
|
|
72
|
+
# This avoids the branch checkout problem entirely.
|
|
73
|
+
jobs:
|
|
74
|
+
deploy:
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/download-artifact@v4
|
|
79
|
+
with:
|
|
80
|
+
run-id: ${{ github.event.workflow_run.id }}
|
|
81
|
+
name: build-output
|
|
82
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
83
|
+
- name: Deploy
|
|
84
|
+
run: ./deploy.sh
|
|
85
|
+
|
|
86
|
+
- language: yaml
|
|
87
|
+
label: "Guard against running on wrong branch with a condition"
|
|
88
|
+
code: |
|
|
89
|
+
jobs:
|
|
90
|
+
deploy:
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
# Only deploy when triggered from the main branch to avoid
|
|
93
|
+
# accidentally deploying non-main code
|
|
94
|
+
if: |
|
|
95
|
+
github.event.workflow_run.conclusion == 'success' &&
|
|
96
|
+
github.event.workflow_run.head_branch == 'main'
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v4
|
|
99
|
+
with:
|
|
100
|
+
ref: ${{ github.event.workflow_run.head_sha }}
|
|
101
|
+
|
|
102
|
+
prevention:
|
|
103
|
+
- "Always specify ref: ${{ github.event.workflow_run.head_sha }} in checkout steps inside workflow_run-triggered jobs."
|
|
104
|
+
- "Prefer downloading build artifacts over re-checking-out source code in workflow_run jobs to avoid branch confusion."
|
|
105
|
+
- "Log github.event.workflow_run.head_branch and head_sha at the start of workflow_run jobs for debugging."
|
|
106
|
+
- "Use the conclusion check (if: github.event.workflow_run.conclusion == 'success') to avoid deploying failed builds."
|
|
107
|
+
|
|
108
|
+
docs:
|
|
109
|
+
- url: "https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run"
|
|
110
|
+
label: "GitHub Docs — workflow_run event"
|
|
111
|
+
- url: "https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow"
|
|
112
|
+
label: "GitHub Docs — Using data from the triggering workflow"
|
|
113
|
+
- url: "https://stackoverflow.com/questions/76184351"
|
|
114
|
+
label: "SO#76184351 — workflow_run job runs on wrong (default) branch"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
id: yaml-syntax-030
|
|
2
|
+
title: "Composite Action run: Step Missing Required shell: Property"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- composite-action
|
|
7
|
+
- shell
|
|
8
|
+
- required-property
|
|
9
|
+
- action-yml
|
|
10
|
+
- schema-validation
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "Required property is missing: shell"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "action\\.yml.*Required property is missing: shell"
|
|
15
|
+
flags: "i"
|
|
16
|
+
error_messages:
|
|
17
|
+
- "Required property is missing: shell"
|
|
18
|
+
- "(Line: 29, Col: 5): Required property is missing: shell"
|
|
19
|
+
- "Error: GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid."
|
|
20
|
+
- "Error: Fail to load action.yml"
|
|
21
|
+
root_cause: |
|
|
22
|
+
Every run: step inside a composite action's action.yml MUST declare an explicit
|
|
23
|
+
shell: property. This is mandatory for composite actions — unlike regular workflow
|
|
24
|
+
run: steps where the runner infers the shell from the operating system, composite
|
|
25
|
+
action steps require an explicit declaration because the action may run on any OS.
|
|
26
|
+
|
|
27
|
+
The validation error fires at workflow preparation time (before any steps execute),
|
|
28
|
+
causing the entire workflow to fail with "Fail to load <action>.yml".
|
|
29
|
+
|
|
30
|
+
This is a common mistake when:
|
|
31
|
+
- Converting a workflow step into a reusable composite action
|
|
32
|
+
- Copying run: steps from a workflow into action.yml without adding shell:
|
|
33
|
+
- Using a third-party composite action whose author omitted the shell: property
|
|
34
|
+
fix: |
|
|
35
|
+
Add shell: to every run: step in the composite action's action.yml.
|
|
36
|
+
|
|
37
|
+
Supported shell values: bash, sh, python, pwsh, powershell, cmd
|
|
38
|
+
|
|
39
|
+
For cross-platform composite actions, use shell: bash (available on all
|
|
40
|
+
GitHub-hosted runners including Windows via Git Bash). If platform-specific
|
|
41
|
+
behavior is needed, use if: runner.os == 'Windows' conditionals with
|
|
42
|
+
separate steps.
|
|
43
|
+
fix_code:
|
|
44
|
+
- language: yaml
|
|
45
|
+
label: "Broken action.yml — run steps missing shell:"
|
|
46
|
+
code: |
|
|
47
|
+
runs:
|
|
48
|
+
using: "composite"
|
|
49
|
+
steps:
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: npm ci
|
|
52
|
+
- name: Run build
|
|
53
|
+
run: npm run build
|
|
54
|
+
- language: yaml
|
|
55
|
+
label: "Fixed action.yml — shell: added to every run step"
|
|
56
|
+
code: |
|
|
57
|
+
runs:
|
|
58
|
+
using: "composite"
|
|
59
|
+
steps:
|
|
60
|
+
- name: Install dependencies
|
|
61
|
+
run: npm ci
|
|
62
|
+
shell: bash
|
|
63
|
+
- name: Run build
|
|
64
|
+
run: npm run build
|
|
65
|
+
shell: bash
|
|
66
|
+
- language: yaml
|
|
67
|
+
label: "Cross-platform composite action with OS-conditional steps"
|
|
68
|
+
code: |
|
|
69
|
+
runs:
|
|
70
|
+
using: "composite"
|
|
71
|
+
steps:
|
|
72
|
+
- name: Run script (cross-platform)
|
|
73
|
+
run: echo "Running on ${{ runner.os }}"
|
|
74
|
+
shell: bash
|
|
75
|
+
- name: Windows-only step
|
|
76
|
+
if: runner.os == 'Windows'
|
|
77
|
+
run: Write-Host "Windows step"
|
|
78
|
+
shell: pwsh
|
|
79
|
+
prevention:
|
|
80
|
+
- "Add actionlint to your CI — it catches missing shell: properties in composite actions."
|
|
81
|
+
- "When creating a new composite action, start from the GitHub documentation template which includes shell: on all run steps."
|
|
82
|
+
- "Every run: step in action.yml requires shell: — add this to code review checklists."
|
|
83
|
+
- "Use rhysd/actionlint locally or as a pre-commit hook to validate composite action syntax before pushing."
|
|
84
|
+
docs:
|
|
85
|
+
- url: "https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action"
|
|
86
|
+
label: "GitHub Docs: Creating a composite action"
|
|
87
|
+
- url: "https://stackoverflow.com/questions/71041836/github-actions-required-property-is-missing-shell"
|
|
88
|
+
label: "Stack Overflow: Required property is missing: shell (Score: 51, 31K views)"
|
|
89
|
+
- url: "https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions"
|
|
90
|
+
label: "GitHub Docs: Metadata syntax for composite actions (runs.steps[*].shell)"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
id: yaml-syntax-025
|
|
2
|
+
title: "secrets Context Unavailable Inside Composite Action Definitions"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- composite-actions
|
|
7
|
+
- secrets-context
|
|
8
|
+
- expression
|
|
9
|
+
- runner-validation
|
|
10
|
+
- context-availability
|
|
11
|
+
- action-yml
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: "Unrecognized named-value.*'?secrets'?"
|
|
14
|
+
flags: "i"
|
|
15
|
+
- regex: "Unexpected value.*secrets\\.\\w+"
|
|
16
|
+
flags: "i"
|
|
17
|
+
error_messages:
|
|
18
|
+
- "Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.MY_TOKEN"
|
|
19
|
+
- "Error: Unrecognized named-value: 'secrets'"
|
|
20
|
+
- "Invalid workflow file: .github/actions/my-action/action.yml (Line 12, Col 18): Unrecognized named-value: 'secrets'"
|
|
21
|
+
root_cause: |
|
|
22
|
+
The `secrets` context is **not available inside composite action definitions** (`action.yml`).
|
|
23
|
+
When a developer writes `${{ secrets.MY_TOKEN }}` inside a composite action's steps or
|
|
24
|
+
expressions, runner validation rejects it with "Unrecognized named-value: 'secrets'".
|
|
25
|
+
|
|
26
|
+
This is a deliberate architectural restriction. Composite actions run in the calling
|
|
27
|
+
workflow's runner environment but do NOT receive the calling workflow's secrets context.
|
|
28
|
+
The `secrets` context is only available in:
|
|
29
|
+
- Regular workflow job steps (`jobs.<job_id>.steps.*`)
|
|
30
|
+
- Reusable workflows (`.github/workflows/*.yml` using `on: workflow_call`)
|
|
31
|
+
|
|
32
|
+
Composite actions (`action.yml` with `using: composite`) only receive values the calling
|
|
33
|
+
workflow explicitly passes as `inputs`. This differs from `vars` context rejection
|
|
34
|
+
(yaml-syntax-016) — both contexts are unavailable in composite actions, but the pattern
|
|
35
|
+
for passing secrets as inputs is worth documenting separately.
|
|
36
|
+
|
|
37
|
+
A common migration mistake: extracting workflow steps that reference `${{ secrets.GITHUB_TOKEN }}`
|
|
38
|
+
into a composite action and expecting them to continue working unchanged.
|
|
39
|
+
fix: |
|
|
40
|
+
Declare an explicit `input` for each secret the composite action needs. The calling workflow
|
|
41
|
+
passes secrets at the `with:` level — where the secrets context IS available. Inside the
|
|
42
|
+
composite action, reference `${{ inputs.token }}` instead of `${{ secrets.MY_TOKEN }}`.
|
|
43
|
+
|
|
44
|
+
Never reference the secrets context directly inside `action.yml` regardless of runner version.
|
|
45
|
+
fix_code:
|
|
46
|
+
- language: yaml
|
|
47
|
+
label: "action.yml — Replace secrets.* with an explicit input"
|
|
48
|
+
code: |
|
|
49
|
+
# ❌ BROKEN: secrets context not available in composite actions
|
|
50
|
+
# .github/actions/deploy/action.yml
|
|
51
|
+
name: Deploy
|
|
52
|
+
description: Deploy to production
|
|
53
|
+
runs:
|
|
54
|
+
using: composite
|
|
55
|
+
steps:
|
|
56
|
+
- name: Authenticate
|
|
57
|
+
shell: bash
|
|
58
|
+
run: |
|
|
59
|
+
# ❌ Will fail: Unrecognized named-value: 'secrets'
|
|
60
|
+
echo "${{ secrets.DEPLOY_TOKEN }}" | docker login ghcr.io -u user --password-stdin
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# ✅ CORRECT: accept token via explicit input
|
|
65
|
+
name: Deploy
|
|
66
|
+
description: Deploy to production
|
|
67
|
+
inputs:
|
|
68
|
+
deploy-token:
|
|
69
|
+
description: "Authentication token for container registry"
|
|
70
|
+
required: true
|
|
71
|
+
runs:
|
|
72
|
+
using: composite
|
|
73
|
+
steps:
|
|
74
|
+
- name: Authenticate
|
|
75
|
+
shell: bash
|
|
76
|
+
run: echo "${{ inputs.deploy-token }}" | docker login ghcr.io -u user --password-stdin
|
|
77
|
+
- language: yaml
|
|
78
|
+
label: "Calling workflow — pass secrets at the with: level"
|
|
79
|
+
code: |
|
|
80
|
+
# ✅ Caller resolves secrets context and passes value as composite action input
|
|
81
|
+
jobs:
|
|
82
|
+
deploy:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- uses: ./.github/actions/deploy
|
|
86
|
+
with:
|
|
87
|
+
deploy-token: ${{ secrets.DEPLOY_TOKEN }} # secrets resolved in caller, not in composite
|
|
88
|
+
prevention:
|
|
89
|
+
- "Never reference `secrets.*` directly inside composite action `action.yml` — require callers to pass secrets as explicit inputs."
|
|
90
|
+
- "When migrating workflow steps to a composite action, replace every `${{ secrets.X }}` with a declared input and update all callers."
|
|
91
|
+
- "Use `actionlint` to statically validate context access in composite actions before pushing."
|
|
92
|
+
- "Composite actions (composite) require explicit input passing for secrets; reusable workflows (workflow_call) support `secrets: inherit`."
|
|
93
|
+
docs:
|
|
94
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#context-availability"
|
|
95
|
+
label: "GitHub Docs: Context availability by element type"
|
|
96
|
+
- url: "https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action"
|
|
97
|
+
label: "GitHub Docs: Creating a composite action"
|
|
98
|
+
- url: "https://stackoverflow.com/questions/73821801/unable-to-use-secrets-in-workflow"
|
|
99
|
+
label: "SO#73821801 — Unrecognized named-value: 'secrets' in composite action (3,059 views)"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
id: yaml-syntax-026
|
|
2
|
+
title: "actions/github-script: 'octokit' Not Defined — API Client Renamed to 'github'"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- github-script
|
|
7
|
+
- octokit
|
|
8
|
+
- javascript
|
|
9
|
+
- api-client
|
|
10
|
+
- breaking-change
|
|
11
|
+
- v4
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: "ReferenceError: octokit is not defined"
|
|
14
|
+
flags: "i"
|
|
15
|
+
- regex: "octokit is not defined"
|
|
16
|
+
flags: "i"
|
|
17
|
+
- regex: "TypeError: Cannot read propert(?:y|ies) of undefined.*octokit"
|
|
18
|
+
flags: "i"
|
|
19
|
+
- regex: "Error: Unhandled error: ReferenceError: octokit is not defined"
|
|
20
|
+
flags: "i"
|
|
21
|
+
error_messages:
|
|
22
|
+
- "ReferenceError: octokit is not defined"
|
|
23
|
+
- "Error: Unhandled error: ReferenceError: octokit is not defined"
|
|
24
|
+
- "Error: Script failed with exit code 1 — ReferenceError: octokit is not defined"
|
|
25
|
+
root_cause: |
|
|
26
|
+
In versions of `actions/github-script` prior to v4, the Octokit REST client
|
|
27
|
+
was injected into the script as a variable named `octokit`. The action was
|
|
28
|
+
refactored and the variable was renamed to `github` in v4 (released late 2020).
|
|
29
|
+
|
|
30
|
+
Many blog posts, Stack Overflow answers, older README examples, and community
|
|
31
|
+
discussions still use the original `octokit` variable name. Developers copying
|
|
32
|
+
these examples encounter `ReferenceError: octokit is not defined` at runtime
|
|
33
|
+
because the variable no longer exists.
|
|
34
|
+
|
|
35
|
+
Available variables injected into `actions/github-script` scripts (v4+):
|
|
36
|
+
- `github` — authenticated Octokit REST + GraphQL client (replaces old `octokit`)
|
|
37
|
+
- `context` — workflow run context (repo, sha, ref, event payload, etc.)
|
|
38
|
+
- `core` — @actions/core (setOutput, setFailed, info, warning, etc.)
|
|
39
|
+
- `glob` — @actions/glob (file globbing utility)
|
|
40
|
+
- `io` — @actions/io (filesystem utilities)
|
|
41
|
+
- `exec` — @actions/exec (run shell commands from script)
|
|
42
|
+
- `require` — restricted require() for loading bundled modules
|
|
43
|
+
|
|
44
|
+
The variable `octokit` does not exist in any released version of
|
|
45
|
+
actions/github-script. It was never a stable public interface — the README
|
|
46
|
+
always showed `github`, but pre-release/alpha samples used `octokit`.
|
|
47
|
+
|
|
48
|
+
A secondary version of this error occurs with `github.rest` vs `github` API
|
|
49
|
+
surface: in v6+, REST methods moved to `github.rest.*` (e.g.,
|
|
50
|
+
`github.rest.issues.create()`). Scripts using `github.issues.create()` (v5
|
|
51
|
+
style) will fail with "TypeError: github.issues.create is not a function"
|
|
52
|
+
on v6+.
|
|
53
|
+
fix: |
|
|
54
|
+
Replace every occurrence of `octokit` in your script with `github`:
|
|
55
|
+
|
|
56
|
+
Before (broken): const result = await octokit.rest.issues.create({...})
|
|
57
|
+
After (correct): const result = await github.rest.issues.create({...})
|
|
58
|
+
|
|
59
|
+
If you are using an older API surface (pre-v6), also update method paths:
|
|
60
|
+
Before (v5): await github.issues.create({...})
|
|
61
|
+
After (v6+): await github.rest.issues.create({...})
|
|
62
|
+
|
|
63
|
+
Check your github-script version — v6 is the current stable release (v7 is
|
|
64
|
+
also available with Node.js 20). Pin to a major version like @v7 rather than
|
|
65
|
+
a commit SHA to get bugfixes without breaking changes.
|
|
66
|
+
fix_code:
|
|
67
|
+
- language: yaml
|
|
68
|
+
label: "Before (broken) vs After (correct) — replace octokit with github"
|
|
69
|
+
code: |
|
|
70
|
+
# BROKEN — uses old `octokit` variable name (throws ReferenceError):
|
|
71
|
+
- uses: actions/github-script@v7
|
|
72
|
+
with:
|
|
73
|
+
script: |
|
|
74
|
+
const { data: issue } = await octokit.rest.issues.create({
|
|
75
|
+
owner: context.repo.owner,
|
|
76
|
+
repo: context.repo.repo,
|
|
77
|
+
title: 'Automated issue',
|
|
78
|
+
body: 'Created by workflow'
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
# CORRECT — use `github` (the injected Octokit client):
|
|
82
|
+
- uses: actions/github-script@v7
|
|
83
|
+
with:
|
|
84
|
+
script: |
|
|
85
|
+
const { data: issue } = await github.rest.issues.create({
|
|
86
|
+
owner: context.repo.owner,
|
|
87
|
+
repo: context.repo.repo,
|
|
88
|
+
title: 'Automated issue',
|
|
89
|
+
body: 'Created by workflow'
|
|
90
|
+
});
|
|
91
|
+
console.log('Created issue #' + issue.number);
|
|
92
|
+
- language: yaml
|
|
93
|
+
label: "Common github-script v5 to v6+ migration — update method paths"
|
|
94
|
+
code: |
|
|
95
|
+
# v5 style (broken on v6+):
|
|
96
|
+
- uses: actions/github-script@v6
|
|
97
|
+
with:
|
|
98
|
+
script: |
|
|
99
|
+
await github.issues.addLabels({ # BROKEN: no github.issues
|
|
100
|
+
issue_number: context.issue.number,
|
|
101
|
+
owner: context.repo.owner,
|
|
102
|
+
repo: context.repo.repo,
|
|
103
|
+
labels: ['bug']
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
# v6+ style (correct):
|
|
107
|
+
- uses: actions/github-script@v7
|
|
108
|
+
with:
|
|
109
|
+
script: |
|
|
110
|
+
await github.rest.issues.addLabels({ # CORRECT: github.rest.*
|
|
111
|
+
issue_number: context.issue.number,
|
|
112
|
+
owner: context.repo.owner,
|
|
113
|
+
repo: context.repo.repo,
|
|
114
|
+
labels: ['bug']
|
|
115
|
+
});
|
|
116
|
+
prevention:
|
|
117
|
+
- "Always use `github` (not `octokit`) as the Octokit client variable in actions/github-script — `octokit` has never been a stable public interface."
|
|
118
|
+
- "Pin to a major version like `actions/github-script@v7` rather than copying scripts from undated blog posts or old Stack Overflow answers that may reference pre-release variable names."
|
|
119
|
+
- "Test scripts locally using the `@octokit/rest` npm package before embedding them in a workflow — you'll get clear errors immediately rather than waiting for a CI run."
|
|
120
|
+
- "Read the actions/github-script README for your pinned version — the variable reference table at the top shows exactly what is injected (github, context, core, glob, io, exec)."
|
|
121
|
+
- "When upgrading from github-script v5 to v6+, update all REST method calls from `github.X.Y()` to `github.rest.X.Y()` — this is the only breaking change between v5 and v6."
|
|
122
|
+
docs:
|
|
123
|
+
- url: "https://github.com/actions/github-script"
|
|
124
|
+
label: "actions/github-script README — available variables (github, context, core, etc.)"
|
|
125
|
+
- url: "https://github.com/actions/github-script/issues/545"
|
|
126
|
+
label: "actions/github-script #545: octokit instance from README examples doesn't work (12 reactions)"
|
|
127
|
+
- url: "https://github.com/actions/github-script/releases/tag/v4.0.0"
|
|
128
|
+
label: "actions/github-script v4 release — renamed octokit → github"
|
|
129
|
+
- url: "https://octokit.github.io/rest.js/v21"
|
|
130
|
+
label: "Octokit REST.js v21 API reference — methods available via github.rest.*"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
id: yaml-syntax-028
|
|
2
|
+
title: "actions/labeler v5 config format breaking change causes unexpected type error"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- labeler
|
|
7
|
+
- v5-breaking-change
|
|
8
|
+
- config-format
|
|
9
|
+
- pull-request-labels
|
|
10
|
+
- migration
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: "found unexpected type for label '.+' \\(should be array of config options\\)"
|
|
13
|
+
flags: "i"
|
|
14
|
+
- regex: "Error: found unexpected type for label"
|
|
15
|
+
flags: "i"
|
|
16
|
+
error_messages:
|
|
17
|
+
- "Error: found unexpected type for label 'frontend' (should be array of config options)"
|
|
18
|
+
- "found unexpected type for label 'X' (should be array of config options)"
|
|
19
|
+
root_cause: |
|
|
20
|
+
actions/labeler v5.0.0 introduced a breaking change to the labeler.yml configuration format.
|
|
21
|
+
In v4 and earlier, labels could be configured as a flat list of glob patterns (strings).
|
|
22
|
+
In v5, each label must be an array of objects with specific keys such as changed-files,
|
|
23
|
+
head-branch, or base-branch. If a workflow pins to @master or @latest and a new major
|
|
24
|
+
version is published, workflows inherit the breaking format without warning.
|
|
25
|
+
The old flat string format ("label: - path/**") is no longer valid in v5 and causes
|
|
26
|
+
the action to throw immediately.
|
|
27
|
+
fix: |
|
|
28
|
+
Either migrate labeler.yml to the v5 object format using changed-files key, or pin the
|
|
29
|
+
action to @v4 to preserve the old flat string format.
|
|
30
|
+
fix_code:
|
|
31
|
+
- language: yaml
|
|
32
|
+
label: "Old v4 format (still works with actions/labeler@v4)"
|
|
33
|
+
code: |
|
|
34
|
+
# .github/labeler.yml (v4 format)
|
|
35
|
+
frontend:
|
|
36
|
+
- shared/frontend/**/*
|
|
37
|
+
backend:
|
|
38
|
+
- shared/api/**/*
|
|
39
|
+
- language: yaml
|
|
40
|
+
label: "New v5 format (required for actions/labeler@v5)"
|
|
41
|
+
code: |
|
|
42
|
+
# .github/labeler.yml (v5 format)
|
|
43
|
+
frontend:
|
|
44
|
+
- changed-files:
|
|
45
|
+
- any-glob-to-any-file: shared/frontend/**/*
|
|
46
|
+
backend:
|
|
47
|
+
- changed-files:
|
|
48
|
+
- any-glob-to-any-file: shared/api/**/*
|
|
49
|
+
- language: yaml
|
|
50
|
+
label: "Pin to v4 to avoid breaking change"
|
|
51
|
+
code: |
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/labeler@v4
|
|
54
|
+
with:
|
|
55
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
prevention:
|
|
57
|
+
- "Never pin actions to @master or @latest branch — always use a major version tag like @v4"
|
|
58
|
+
- "Review the CHANGELOG or release notes before bumping a major version of any action"
|
|
59
|
+
- "Use Dependabot with major version grouping to get explicit upgrade PRs for breaking changes"
|
|
60
|
+
- "Test label config changes in a fork or draft PR before merging"
|
|
61
|
+
docs:
|
|
62
|
+
- url: "https://github.com/actions/labeler/issues/710"
|
|
63
|
+
label: "actions/labeler#710: found unexpected type for label (v5 breaking change)"
|
|
64
|
+
- url: "https://github.com/actions/labeler/releases/tag/v5.0.0"
|
|
65
|
+
label: "actions/labeler v5.0.0 release notes"
|
|
66
|
+
- url: "https://github.com/actions/labeler/tree/main#pull-request-labeler"
|
|
67
|
+
label: "actions/labeler v5 configuration documentation"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
id: yaml-syntax-024
|
|
2
|
+
title: "Reusable Workflow Nesting Exceeds Maximum Depth of 4 Levels"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- reusable-workflow
|
|
7
|
+
- nesting
|
|
8
|
+
- depth-limit
|
|
9
|
+
- workflow_call
|
|
10
|
+
- yaml-parse-error
|
|
11
|
+
|
|
12
|
+
patterns:
|
|
13
|
+
- regex: "would exceed the limit on called workflow depth of \\d+"
|
|
14
|
+
flags: "i"
|
|
15
|
+
- regex: "calls workflow .+, but doing so would exceed the limit"
|
|
16
|
+
flags: "i"
|
|
17
|
+
|
|
18
|
+
error_messages:
|
|
19
|
+
- "error parsing called workflow \"./.github/workflows/deploy.yml@\": job \"build\" calls workflow \"./.github/workflows/release.yml@\", but doing so would exceed the limit on called workflow depth of 3"
|
|
20
|
+
- "but doing so would exceed the limit on called workflow depth of 3"
|
|
21
|
+
|
|
22
|
+
root_cause: |
|
|
23
|
+
GitHub Actions enforces a maximum reusable workflow call depth of 4 levels total.
|
|
24
|
+
The top-level workflow counts as level 1, so the maximum number of sequential
|
|
25
|
+
workflow_call hops is 3 (levels 2, 3, and 4).
|
|
26
|
+
|
|
27
|
+
The error message says "depth of 3" because it refers to the maximum allowed
|
|
28
|
+
zero-indexed depth of called workflows, not the total chain length. When your
|
|
29
|
+
chain would require a 4th call (fifth total workflow), GitHub rejects the YAML
|
|
30
|
+
at parse time — before any runner picks up the job.
|
|
31
|
+
|
|
32
|
+
Example chain that fails:
|
|
33
|
+
root.yml → a.yml → b.yml → c.yml → d.yml (depth index 4 → rejected)
|
|
34
|
+
|
|
35
|
+
Example chain that succeeds:
|
|
36
|
+
root.yml → a.yml → b.yml → c.yml (depth index 3 → allowed)
|
|
37
|
+
|
|
38
|
+
This limit was increased from 2 to 3 in August 2022 and is currently fixed at 4
|
|
39
|
+
total levels (depth index 0–3).
|
|
40
|
+
|
|
41
|
+
fix: |
|
|
42
|
+
Reduce the nesting depth so the total chain is 4 levels or fewer.
|
|
43
|
+
Strategies:
|
|
44
|
+
|
|
45
|
+
1. Flatten: merge two deeply-nested reusable workflows into one.
|
|
46
|
+
2. Convert inner reusables to composite actions — composite actions do NOT
|
|
47
|
+
count toward the reusable workflow depth limit.
|
|
48
|
+
3. Restructure so leaf workflows are composite actions, keeping reusable
|
|
49
|
+
workflows only at the top layers.
|
|
50
|
+
|
|
51
|
+
fix_code:
|
|
52
|
+
- language: yaml
|
|
53
|
+
label: "Replace inner reusable workflow with a composite action"
|
|
54
|
+
code: |
|
|
55
|
+
# Instead of calling another reusable workflow at depth 4,
|
|
56
|
+
# use a composite action in .github/actions/my-task/action.yml
|
|
57
|
+
# which has no depth limit.
|
|
58
|
+
|
|
59
|
+
# .github/actions/my-task/action.yml
|
|
60
|
+
name: My Task
|
|
61
|
+
description: Previously a reusable workflow, now a composite action
|
|
62
|
+
runs:
|
|
63
|
+
using: composite
|
|
64
|
+
steps:
|
|
65
|
+
- name: Do the work
|
|
66
|
+
shell: bash
|
|
67
|
+
run: echo "doing the work"
|
|
68
|
+
|
|
69
|
+
# Called from the deeply-nested workflow:
|
|
70
|
+
- name: Run my task
|
|
71
|
+
uses: ./.github/actions/my-task # composite, no depth counted
|
|
72
|
+
|
|
73
|
+
- language: yaml
|
|
74
|
+
label: "Flatten two reusable workflows into one to reduce depth"
|
|
75
|
+
code: |
|
|
76
|
+
# Before (depth 4 — fails):
|
|
77
|
+
# root.yml → build.yml → test.yml → lint.yml → scan.yml
|
|
78
|
+
#
|
|
79
|
+
# After (depth 3 — passes):
|
|
80
|
+
# Merge lint.yml and scan.yml into a single quality.yml
|
|
81
|
+
|
|
82
|
+
# quality.yml
|
|
83
|
+
on:
|
|
84
|
+
workflow_call:
|
|
85
|
+
inputs:
|
|
86
|
+
target:
|
|
87
|
+
required: true
|
|
88
|
+
type: string
|
|
89
|
+
jobs:
|
|
90
|
+
lint:
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v4
|
|
94
|
+
- run: echo "linting ${{ inputs.target }}"
|
|
95
|
+
scan:
|
|
96
|
+
runs-on: ubuntu-latest
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v4
|
|
99
|
+
- run: echo "scanning ${{ inputs.target }}"
|
|
100
|
+
|
|
101
|
+
prevention:
|
|
102
|
+
- "Map your reusable workflow call chain before writing YAML — count total levels."
|
|
103
|
+
- "Prefer composite actions for leaf-level tasks; they have no depth limit."
|
|
104
|
+
- "Limit reusable workflow use to high-value shared orchestration layers, not every step."
|
|
105
|
+
- "If depth 4 is genuinely required, consider splitting the pipeline into separate triggered workflows using workflow_run instead of nested workflow_call."
|
|
106
|
+
|
|
107
|
+
docs:
|
|
108
|
+
- url: "https://docs.github.com/en/actions/using-workflows/reusing-workflows#nesting-reusable-workflows"
|
|
109
|
+
label: "GitHub Docs — Nesting reusable workflows"
|
|
110
|
+
- url: "https://github.blog/changelog/2022-08-22-github-actions-improvements-to-reusable-workflows-2/"
|
|
111
|
+
label: "GitHub Changelog — Nesting increased to 4 levels (August 2022)"
|
|
112
|
+
- url: "https://github.com/actions/runner/issues/1797"
|
|
113
|
+
label: "actions/runner#1797 — Original depth-limit enhancement request"
|