@htekdev/actions-debugger 1.0.63 → 1.0.65
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/known-unsolved/service-containers-not-supported-macos-windows.yml +88 -0
- package/errors/silent-failures/workflow-run-github-sha-is-default-branch.yml +78 -0
- package/errors/triggers/push-commits-truncated-20-limit.yml +78 -0
- package/errors/yaml-syntax/runs-on-env-context-unavailable.yml +82 -0
- package/package.json +2 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
id: known-unsolved-041
|
|
2
|
+
title: "services: Block Not Supported on macOS and Windows Runners — Silently Ignored"
|
|
3
|
+
category: known-unsolved
|
|
4
|
+
severity: limitation
|
|
5
|
+
tags:
|
|
6
|
+
- services
|
|
7
|
+
- service-containers
|
|
8
|
+
- macos
|
|
9
|
+
- windows
|
|
10
|
+
- linux-only
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: 'services\s*:'
|
|
13
|
+
flags: 'im'
|
|
14
|
+
- regex: 'runs-on\s*:\s*(macos|windows)'
|
|
15
|
+
flags: 'i'
|
|
16
|
+
error_messages:
|
|
17
|
+
- "Connection refused 127.0.0.1:5432"
|
|
18
|
+
- "Unable to connect to the database server"
|
|
19
|
+
- "ECONNREFUSED"
|
|
20
|
+
- "connect ECONNREFUSED 127.0.0.1:6379"
|
|
21
|
+
root_cause: |
|
|
22
|
+
GitHub Actions `services:` containers are only supported on Linux (Ubuntu) runners.
|
|
23
|
+
On macOS and Windows GitHub-hosted runners, the `services:` block is silently ignored
|
|
24
|
+
— the job starts without the service containers, and no warning or error is emitted
|
|
25
|
+
at the workflow syntax level.
|
|
26
|
+
|
|
27
|
+
This happens because the runner agent's service container feature requires Docker
|
|
28
|
+
to be integrated at the runner daemon level. GitHub-hosted macOS and Windows runners
|
|
29
|
+
do not have a running Docker daemon available to the runner agent by default, making
|
|
30
|
+
the `services:` lifecycle management impossible.
|
|
31
|
+
|
|
32
|
+
The failure is deceptive: the job starts normally, all steps run, but any step that
|
|
33
|
+
tries to connect to the service (e.g., PostgreSQL on port 5432, Redis on port 6379)
|
|
34
|
+
receives a connection refused error. The `services:` block produces no visible error
|
|
35
|
+
of its own.
|
|
36
|
+
|
|
37
|
+
There is no GitHub Actions built-in mechanism to make `services:` work on macOS or
|
|
38
|
+
Windows runners. This is a permanent platform limitation.
|
|
39
|
+
fix: |
|
|
40
|
+
Use a Linux (ubuntu-*) runner for any job that requires service containers. If macOS
|
|
41
|
+
or Windows testing is required alongside a service dependency, start the service
|
|
42
|
+
manually as workflow steps within the job instead of using the `services:` block.
|
|
43
|
+
fix_code:
|
|
44
|
+
- language: yaml
|
|
45
|
+
label: "services: block — only works on Linux runners"
|
|
46
|
+
code: |
|
|
47
|
+
jobs:
|
|
48
|
+
test:
|
|
49
|
+
runs-on: ubuntu-latest # services: requires Linux
|
|
50
|
+
services:
|
|
51
|
+
postgres:
|
|
52
|
+
image: postgres:15
|
|
53
|
+
env:
|
|
54
|
+
POSTGRES_PASSWORD: postgres
|
|
55
|
+
ports:
|
|
56
|
+
- 5432:5432
|
|
57
|
+
options: >-
|
|
58
|
+
--health-cmd pg_isready
|
|
59
|
+
--health-interval 10s
|
|
60
|
+
--health-timeout 5s
|
|
61
|
+
--health-retries 5
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
- run: npm test
|
|
65
|
+
- language: yaml
|
|
66
|
+
label: "macOS/Windows: start service manually as a workflow step"
|
|
67
|
+
code: |
|
|
68
|
+
jobs:
|
|
69
|
+
test-macos:
|
|
70
|
+
runs-on: macos-latest
|
|
71
|
+
# services: is NOT supported here — start the service manually instead
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- name: Start PostgreSQL (services: not supported on macOS)
|
|
75
|
+
run: |
|
|
76
|
+
brew install postgresql@15
|
|
77
|
+
brew services start postgresql@15
|
|
78
|
+
sleep 5
|
|
79
|
+
- run: npm test
|
|
80
|
+
prevention:
|
|
81
|
+
- "Always pair the `services:` block with a Linux (ubuntu-*) runner — treat this as a hard rule in code review"
|
|
82
|
+
- "If cross-platform testing needs a service dependency, isolate the service-dependent tests into a Linux-only job"
|
|
83
|
+
- "Add a comment near the `services:` block to document that this job must run on Linux"
|
|
84
|
+
docs:
|
|
85
|
+
- url: "https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/about-service-containers"
|
|
86
|
+
label: "GitHub Docs: About service containers (Linux-only requirement)"
|
|
87
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idservices"
|
|
88
|
+
label: "GitHub Docs: jobs.<job_id>.services syntax reference"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
id: silent-failures-064
|
|
2
|
+
title: "workflow_run Trigger: github.sha Points to Default Branch HEAD, Not Triggering Workflow's Commit"
|
|
3
|
+
category: silent-failures
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- workflow_run
|
|
7
|
+
- github-sha
|
|
8
|
+
- checkout
|
|
9
|
+
- wrong-commit
|
|
10
|
+
- cross-workflow
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: 'on\s*:\s*\n\s+workflow_run'
|
|
13
|
+
flags: 'im'
|
|
14
|
+
- regex: 'github\.sha'
|
|
15
|
+
flags: 'i'
|
|
16
|
+
error_messages:
|
|
17
|
+
- "Unexpected checkout SHA — does not match pull request head commit"
|
|
18
|
+
- "Tests passing on default branch but failing on PR commit"
|
|
19
|
+
root_cause: |
|
|
20
|
+
When a workflow is triggered by `on: workflow_run`, the `github.sha` and `github.ref`
|
|
21
|
+
context variables point to the HEAD of the **default branch** at the time the trigger
|
|
22
|
+
fires, NOT to the commit that triggered the upstream workflow. This is by design: the
|
|
23
|
+
`workflow_run` event executes in the context of the base repository's default branch.
|
|
24
|
+
|
|
25
|
+
Workflows that use `actions/checkout` without specifying a `ref` will silently check
|
|
26
|
+
out the default branch — running against entirely different code than the PR or branch
|
|
27
|
+
that triggered the original CI workflow. CI results, security scans, and deployments
|
|
28
|
+
end up referencing the wrong commit with no visible error.
|
|
29
|
+
|
|
30
|
+
The correct commit SHA from the triggering workflow is available in the event payload
|
|
31
|
+
as `github.event.workflow_run.head_sha`.
|
|
32
|
+
fix: |
|
|
33
|
+
Use `github.event.workflow_run.head_sha` as the `ref` in `actions/checkout` within
|
|
34
|
+
any `workflow_run` triggered workflow. When the triggering workflow originates from a
|
|
35
|
+
fork PR, also supply `github.event.workflow_run.head_repository.full_name` as the
|
|
36
|
+
`repository` input so the correct fork is checked out.
|
|
37
|
+
fix_code:
|
|
38
|
+
- language: yaml
|
|
39
|
+
label: "Wrong: default checkout uses github.sha (default branch HEAD)"
|
|
40
|
+
code: |
|
|
41
|
+
on:
|
|
42
|
+
workflow_run:
|
|
43
|
+
workflows: ["CI"]
|
|
44
|
+
types: [completed]
|
|
45
|
+
|
|
46
|
+
jobs:
|
|
47
|
+
process:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
# Silently checks out default branch, NOT the triggering commit
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- language: yaml
|
|
53
|
+
label: "Correct: use workflow_run event payload for the right commit"
|
|
54
|
+
code: |
|
|
55
|
+
on:
|
|
56
|
+
workflow_run:
|
|
57
|
+
workflows: ["CI"]
|
|
58
|
+
types: [completed]
|
|
59
|
+
|
|
60
|
+
jobs:
|
|
61
|
+
process:
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
with:
|
|
66
|
+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
|
|
67
|
+
ref: ${{ github.event.workflow_run.head_sha }}
|
|
68
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
69
|
+
prevention:
|
|
70
|
+
- "Always set `ref: ${{ github.event.workflow_run.head_sha }}` in checkout steps inside workflow_run triggered workflows"
|
|
71
|
+
- "Log both `github.sha` and `github.event.workflow_run.head_sha` at workflow start to verify they match when expected"
|
|
72
|
+
- "For fork-originated PRs, also set `repository: ${{ github.event.workflow_run.head_repository.full_name }}`"
|
|
73
|
+
- "Add a comment in the workflow explaining why head_sha is used instead of github.sha to avoid future confusion"
|
|
74
|
+
docs:
|
|
75
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_run"
|
|
76
|
+
label: "GitHub Docs: workflow_run event (context behavior)"
|
|
77
|
+
- url: "https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/"
|
|
78
|
+
label: "GitHub Security Lab: Preventing pwn requests (workflow_run checkout patterns)"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
id: triggers-046
|
|
2
|
+
title: "github.event.commits Array Truncated to 20 Commits on Large Pushes"
|
|
3
|
+
category: triggers
|
|
4
|
+
severity: silent-failure
|
|
5
|
+
tags:
|
|
6
|
+
- push
|
|
7
|
+
- commits
|
|
8
|
+
- github-event
|
|
9
|
+
- truncated
|
|
10
|
+
- commit-messages
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: 'github\.event\.commits'
|
|
13
|
+
flags: 'i'
|
|
14
|
+
error_messages:
|
|
15
|
+
- "Only processing 20 of N commits"
|
|
16
|
+
- "Missing commits in push event payload"
|
|
17
|
+
root_cause: |
|
|
18
|
+
When a push event triggers a workflow, the `github.event.commits` array is capped at
|
|
19
|
+
a maximum of 20 commit objects, regardless of how many commits were included in the
|
|
20
|
+
push. This limit applies to the webhook payload that populates the `github.event`
|
|
21
|
+
context and is documented in the GitHub webhook specification.
|
|
22
|
+
|
|
23
|
+
Workflows that iterate over `github.event.commits` to extract commit messages for
|
|
24
|
+
changelog generation, enforce commit message formatting (Conventional Commits, etc.),
|
|
25
|
+
or trigger conditional logic based on commit content will silently miss any commits
|
|
26
|
+
beyond the 20th. The job completes successfully with no indication that commits were
|
|
27
|
+
dropped from the payload.
|
|
28
|
+
|
|
29
|
+
Commonly affected use cases:
|
|
30
|
+
- Automated changelog or release note generation from push commit messages
|
|
31
|
+
- Commit message linting or conventional commits enforcement
|
|
32
|
+
- Workflows triggered by specific keywords in commit messages
|
|
33
|
+
- Security scanning workflows that enumerate all modified files from commit diffs
|
|
34
|
+
fix: |
|
|
35
|
+
Use `git log` with the push SHA range (`github.event.before..github.event.after`) to
|
|
36
|
+
enumerate all commits in the push, regardless of count. This requires checking out
|
|
37
|
+
the repository with `fetch-depth: 0` (full history) or at minimum enough depth to
|
|
38
|
+
span the push range. Guard against the `before` SHA being all zeros (first push to
|
|
39
|
+
a new branch).
|
|
40
|
+
fix_code:
|
|
41
|
+
- language: yaml
|
|
42
|
+
label: "Wrong: iterating github.event.commits silently misses commits beyond 20"
|
|
43
|
+
code: |
|
|
44
|
+
- name: Lint commit messages
|
|
45
|
+
run: |
|
|
46
|
+
# Silently processes only up to 20 commits even on large pushes
|
|
47
|
+
echo '${{ toJSON(github.event.commits) }}' \
|
|
48
|
+
| jq -r '.[].message' \
|
|
49
|
+
| npx commitlint --from stdin
|
|
50
|
+
- language: yaml
|
|
51
|
+
label: "Correct: use git log with push range to enumerate all commits"
|
|
52
|
+
code: |
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
|
+
with:
|
|
55
|
+
fetch-depth: 0 # full history required for git log range
|
|
56
|
+
|
|
57
|
+
- name: Lint all commit messages in push
|
|
58
|
+
run: |
|
|
59
|
+
BEFORE="${{ github.event.before }}"
|
|
60
|
+
AFTER="${{ github.event.after }}"
|
|
61
|
+
|
|
62
|
+
# Guard: first push to a new branch has before = 000...000
|
|
63
|
+
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
|
|
64
|
+
echo "First push to new branch — scanning tip commit only"
|
|
65
|
+
git log -1 --format="%s" "$AFTER"
|
|
66
|
+
else
|
|
67
|
+
git log --format="%s" "${BEFORE}..${AFTER}"
|
|
68
|
+
fi | npx commitlint --from stdin
|
|
69
|
+
prevention:
|
|
70
|
+
- "Never rely on `github.event.commits` for exhaustive commit enumeration on pushes — use `git log` with the SHA range instead"
|
|
71
|
+
- "Always add `fetch-depth: 0` to checkout when your workflow needs to enumerate commits from the push range"
|
|
72
|
+
- "Guard against `github.event.before` being all zeros (new branch first push) before running `git log BEFORE..AFTER`"
|
|
73
|
+
- "If commit count matters, log a warning when `github.event.commits | length == 20` to detect truncation"
|
|
74
|
+
docs:
|
|
75
|
+
- url: "https://docs.github.com/en/webhooks/webhook-events-and-payloads#push"
|
|
76
|
+
label: "GitHub Docs: Push webhook payload (20 commit limit)"
|
|
77
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#push"
|
|
78
|
+
label: "GitHub Docs: push event trigger"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
id: yaml-syntax-043
|
|
2
|
+
title: "env Context Not Available in runs-on Expression — Job Waits for Non-Existent Runner"
|
|
3
|
+
category: yaml-syntax
|
|
4
|
+
severity: error
|
|
5
|
+
tags:
|
|
6
|
+
- runs-on
|
|
7
|
+
- env-context
|
|
8
|
+
- context-availability
|
|
9
|
+
- runner-selection
|
|
10
|
+
- expression
|
|
11
|
+
patterns:
|
|
12
|
+
- regex: 'runs-on\s*:.*\$\{\{.*env\.'
|
|
13
|
+
flags: 'i'
|
|
14
|
+
error_messages:
|
|
15
|
+
- "No runner matching the specified labels was found"
|
|
16
|
+
- "Context access might be invalid: env"
|
|
17
|
+
- "Evaluates to empty string in runs-on"
|
|
18
|
+
root_cause: |
|
|
19
|
+
The `env` context is not available in `jobs.<job_id>.runs-on` expressions. GitHub
|
|
20
|
+
Actions documents an explicit context availability table, and `env` is excluded from
|
|
21
|
+
the `runs-on` field. Only the `github`, `needs`, `strategy`, `matrix`, `vars`, and
|
|
22
|
+
`inputs` contexts are available for `runs-on` expressions.
|
|
23
|
+
|
|
24
|
+
When a developer writes `runs-on: ${{ env.RUNNER_LABEL }}`, the expression evaluates
|
|
25
|
+
to an empty string (since `env` is not accessible at that evaluation point). GitHub
|
|
26
|
+
Actions may emit the warning "Context access might be invalid: env" during workflow
|
|
27
|
+
parsing. The job then queues waiting for a runner matching an empty or literal label,
|
|
28
|
+
which never matches, and the job hangs until it times out.
|
|
29
|
+
|
|
30
|
+
This is a common mistake when setting a custom self-hosted runner label as a
|
|
31
|
+
workflow-level or job-level `env:` variable and trying to reference it in `runs-on`
|
|
32
|
+
for DRY configuration.
|
|
33
|
+
fix: |
|
|
34
|
+
Use the `vars` context (repository, organization, or environment variables) instead of
|
|
35
|
+
`env` for dynamic runner label selection. Repository variables can be set in the
|
|
36
|
+
repository's Settings > Secrets and variables > Variables and referenced as
|
|
37
|
+
`${{ vars.RUNNER_LABEL }}`. The `vars` context IS available in `runs-on` expressions.
|
|
38
|
+
|
|
39
|
+
Alternatively, use `inputs` context for `workflow_dispatch` triggered workflows to
|
|
40
|
+
allow callers to specify the runner label.
|
|
41
|
+
fix_code:
|
|
42
|
+
- language: yaml
|
|
43
|
+
label: "Wrong: env context is not available in runs-on"
|
|
44
|
+
code: |
|
|
45
|
+
env:
|
|
46
|
+
RUNNER_LABEL: self-hosted-prod # This env var cannot be used in runs-on
|
|
47
|
+
|
|
48
|
+
jobs:
|
|
49
|
+
deploy:
|
|
50
|
+
# ERROR: env context unavailable — expression evaluates to empty string
|
|
51
|
+
runs-on: ${{ env.RUNNER_LABEL }}
|
|
52
|
+
- language: yaml
|
|
53
|
+
label: "Correct: use vars context (repository/org variable)"
|
|
54
|
+
code: |
|
|
55
|
+
# Set RUNNER_LABEL in Settings > Secrets and variables > Variables (repo or org level)
|
|
56
|
+
jobs:
|
|
57
|
+
deploy:
|
|
58
|
+
runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-latest' }}
|
|
59
|
+
- language: yaml
|
|
60
|
+
label: "Correct: use inputs for workflow_dispatch dynamic runner selection"
|
|
61
|
+
code: |
|
|
62
|
+
on:
|
|
63
|
+
workflow_dispatch:
|
|
64
|
+
inputs:
|
|
65
|
+
runner:
|
|
66
|
+
description: 'Runner label'
|
|
67
|
+
default: 'ubuntu-latest'
|
|
68
|
+
type: string
|
|
69
|
+
|
|
70
|
+
jobs:
|
|
71
|
+
deploy:
|
|
72
|
+
runs-on: ${{ inputs.runner }}
|
|
73
|
+
prevention:
|
|
74
|
+
- "Check GitHub's context availability table before using any context in `runs-on` — `env` is NOT available there"
|
|
75
|
+
- "Use `vars.*` (repository or org variables) not `env.*` for dynamic runner label configuration"
|
|
76
|
+
- "Add `|| 'ubuntu-latest'` as a fallback in `runs-on` expressions to avoid jobs that queue indefinitely"
|
|
77
|
+
- "If the job hangs immediately after queuing with no runner assignment, check `runs-on` expressions for invalid context usage"
|
|
78
|
+
docs:
|
|
79
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#context-availability"
|
|
80
|
+
label: "GitHub Docs: Context availability table (runs-on allowed contexts)"
|
|
81
|
+
- url: "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on"
|
|
82
|
+
label: "GitHub Docs: jobs.<job_id>.runs-on expressions"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htekdev/actions-debugger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
4
4
|
"description": "65+ real GitHub Actions errors, queryable by agents. CLI + MCP server + Copilot skills + error database.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@types/node": "^22.0.0",
|
|
68
68
|
"tsx": "^4.19.0",
|
|
69
69
|
"typescript": "^5.7.0",
|
|
70
|
-
"vitest": "^
|
|
70
|
+
"vitest": "^4.1.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=20.0.0"
|