@htekdev/actions-debugger 1.0.75 → 1.0.76

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.
@@ -0,0 +1,115 @@
1
+ id: permissions-auth-047
2
+ title: "Org-Level Policy Blocks GitHub Actions from Creating or Approving Pull Requests Even with pull-requests: write"
3
+ category: permissions-auth
4
+ severity: error
5
+ tags:
6
+ - pull-requests
7
+ - permissions
8
+ - org-policy
9
+ - github-token
10
+ - create-pr
11
+ - branch-protection
12
+ patterns:
13
+ - regex: 'GitHub Actions is not permitted to create or approve pull requests'
14
+ flags: 'i'
15
+ - regex: 'Resource not accessible by integration'
16
+ flags: 'i'
17
+ - regex: 'HttpError.*403.*pull request'
18
+ flags: 'i'
19
+ error_messages:
20
+ - "GitHub Actions is not permitted to create or approve pull requests."
21
+ - "HttpError: Resource not accessible by integration"
22
+ - "Error: 403 - {\"message\":\"GitHub Actions is not permitted to create or approve pull requests.\",\"documentation_url\":\"https://docs.github.com/rest/pulls/pulls\"}"
23
+ - "Error: Validation Failed: pull request creation is not allowed for this repository"
24
+ root_cause: |
25
+ GitHub enforces a two-level policy hierarchy for GitHub Actions creating or
26
+ approving pull requests:
27
+
28
+ 1. **Organization level** — GitHub organization owners must enable
29
+ "Allow GitHub Actions to create and approve pull requests" under:
30
+ Organization Settings → Actions → General → Workflow permissions
31
+
32
+ 2. **Repository level** — After the org-level setting is enabled, each repository
33
+ can independently enable or disable the same option. The repo-level option is
34
+ grayed out and non-interactive until the org-level gate is open.
35
+
36
+ 3. **Enterprise level** — For GitHub Enterprise accounts, the same setting must
37
+ also be enabled at the enterprise level (Enterprise Settings → Actions → General)
38
+ before it can be configured at the org level.
39
+
40
+ Adding `permissions: pull-requests: write` (or `permissions: write-all`) to the
41
+ workflow YAML only controls the GITHUB_TOKEN's OAuth scope. The org/enterprise policy
42
+ is an additional administrative gate enforced by the GitHub API regardless of what
43
+ the token is scoped for. The token can have `pull-requests: write` scope but still
44
+ receive HTTP 403 if the org policy is disabled.
45
+
46
+ The repo-level "Read and write permissions" setting in repo Settings → Actions → General
47
+ is a second distinct control — it sets the token's default permissions but still
48
+ cannot override a disabled org-level policy.
49
+ fix: |
50
+ Step 1 — Enable the setting at the **organization level** (requires org owner):
51
+ https://github.com/organizations/YOUR_ORG/settings/actions
52
+ Under "Workflow permissions" → check "Allow GitHub Actions to create and approve pull requests"
53
+
54
+ Step 2 — Enable the setting at the **repository level** (the option is now clickable):
55
+ https://github.com/YOUR_ORG/YOUR_REPO/settings/actions
56
+ Under "Workflow permissions" → check "Allow GitHub Actions to create and approve pull requests"
57
+
58
+ Step 3 — Add the permission to the workflow file:
59
+ permissions: pull-requests: write (plus contents: write if creating commits)
60
+
61
+ For GitHub Enterprise: also enable at enterprise level first:
62
+ https://github.com/enterprises/YOUR_ENTERPRISE/settings/actions
63
+
64
+ For personal accounts (no org):
65
+ Go to Repository Settings → Actions → General → Workflow permissions →
66
+ set "Read and write permissions".
67
+ fix_code:
68
+ - language: yaml
69
+ label: "Add required permissions to the workflow job"
70
+ code: |
71
+ jobs:
72
+ create-pr:
73
+ runs-on: ubuntu-latest
74
+ permissions:
75
+ contents: write # required to push branches
76
+ pull-requests: write # required to create/comment on PRs
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ - name: Create Pull Request
80
+ uses: peter-evans/create-pull-request@v6
81
+ with:
82
+ title: 'chore: automated update'
83
+ branch: 'automated/update'
84
+ - language: yaml
85
+ label: "Using gh CLI to create a PR (also requires pull-requests: write + org policy enabled)"
86
+ code: |
87
+ jobs:
88
+ open-pr:
89
+ runs-on: ubuntu-latest
90
+ permissions:
91
+ contents: write
92
+ pull-requests: write
93
+ steps:
94
+ - uses: actions/checkout@v4
95
+ - name: Open PR
96
+ env:
97
+ GH_TOKEN: ${{ github.token }}
98
+ run: |
99
+ gh pr create \
100
+ --title "chore: automated update" \
101
+ --body "Created by GitHub Actions" \
102
+ --base main \
103
+ --head "${{ github.ref_name }}"
104
+ prevention:
105
+ - "Before building PR-automation workflows, verify the org-level 'Allow GitHub Actions to create and approve pull requests' setting is enabled."
106
+ - "Check the setting at all applicable levels — enterprise (if applicable) → organization → repository."
107
+ - "Always declare explicit `permissions:` in workflows that create PRs; do not rely on repository defaults."
108
+ - "Use `permissions: pull-requests: write` at the job level (not workflow level) to minimize token scope."
109
+ docs:
110
+ - url: "https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests"
111
+ label: "GitHub Docs — Preventing GitHub Actions from creating or approving pull requests"
112
+ - url: "https://docs.github.com/en/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#preventing-github-actions-from-creating-or-approving-pull-requests"
113
+ label: "GitHub Docs — Org-level: disabling GitHub Actions from creating pull requests"
114
+ - url: "https://stackoverflow.com/questions/72376229/github-actions-is-not-permitted-to-create-or-approve-pull-requests"
115
+ label: "SO: GitHub Actions is not permitted to create or approve pull requests (67 votes, 40k views)"
@@ -0,0 +1,103 @@
1
+ id: runner-environment-137
2
+ title: "bash -eo pipefail Default Causes grep Exit Code 1 (No Matches) to Fail the Step"
3
+ category: runner-environment
4
+ severity: error
5
+ tags:
6
+ - bash
7
+ - grep
8
+ - pipefail
9
+ - set-e
10
+ - shell
11
+ - exit-code
12
+ patterns:
13
+ - regex: 'Error: Process completed with exit code 1\.'
14
+ flags: 'i'
15
+ - regex: 'grep.*exit code 1'
16
+ flags: 'i'
17
+ root_cause: |
18
+ GitHub Actions `run:` steps on Linux/macOS use `bash -e {0}` by default when no
19
+ `shell:` is specified. When `shell: bash` is explicitly set, the shell is invoked
20
+ as `bash --noprofile --norc -eo pipefail {0}`, adding `-o pipefail`.
21
+
22
+ The key behavior:
23
+ - `-e` (set -e) — any command that exits non-zero immediately aborts the whole step.
24
+ - `grep` returns exit code 1 when it finds zero matches (not an error in the shell
25
+ sense, but a non-zero exit). Combined with `-e`, a `grep` that matches nothing
26
+ kills the step with "Error: Process completed with exit code 1."
27
+ - The issue is silent — the step log shows the grep command output (or no output)
28
+ and then suddenly fails. Developers who test locally (where `set -e` is not the
29
+ default interactive shell setting) never reproduce the failure.
30
+
31
+ Common triggers:
32
+ - `grep -c pattern file` when pattern not found → exits 1
33
+ - `git log | grep "pattern"` in CI where the pattern is absent
34
+ - Variable assignment: `COUNT=$(echo "$LIST" | grep -c "value")` — if grep exits 1,
35
+ the subshell exits 1, and `-e` aborts the parent step
36
+ error_messages:
37
+ - "Error: Process completed with exit code 1."
38
+ - "##[error]Process completed with exit code 1."
39
+ fix: |
40
+ Several options depending on your use case:
41
+
42
+ Option 1 — Disable fail-fast for a specific command using `|| true`:
43
+ Append `|| true` to any grep command where zero matches is acceptable. The `|| true`
44
+ ensures the overall expression always exits 0.
45
+
46
+ Option 2 — Disable `set -e` for the entire step with `shell: bash {0}`:
47
+ Using `{0}` as the script placeholder removes the `-e` flag. Use this when you need
48
+ full control over exit codes throughout the step.
49
+
50
+ Option 3 — Use `set +e` at the top of the run block to disable fail-fast for all
51
+ subsequent commands, then selectively handle errors manually.
52
+
53
+ Option 4 — Use grep's `--quiet` / `-q` flag and evaluate with an `if` statement,
54
+ never relying on exit code propagation.
55
+ fix_code:
56
+ - language: yaml
57
+ label: "WRONG — grep exit code 1 kills step when no match found"
58
+ code: |
59
+ - name: Count matches
60
+ run: |
61
+ COUNT=$(echo "$DIFF" | grep -c "src/my_folder")
62
+ echo "Changed files: $COUNT"
63
+ - language: yaml
64
+ label: "CORRECT — append || true to grep commands where zero matches is valid"
65
+ code: |
66
+ - name: Count matches
67
+ run: |
68
+ COUNT=$(echo "$DIFF" | grep -c "src/my_folder" || true)
69
+ echo "Changed files: $COUNT"
70
+ - language: yaml
71
+ label: "CORRECT — disable set -e for entire step with shell: bash {0}"
72
+ code: |
73
+ - name: Count matches
74
+ shell: bash {0}
75
+ run: |
76
+ COUNT=$(echo "$DIFF" | grep -c "src/my_folder")
77
+ echo "Changed files: $COUNT"
78
+ # now exit codes must be checked manually
79
+ - language: yaml
80
+ label: "CORRECT — use grep -q with explicit if for boolean presence check"
81
+ code: |
82
+ - name: Check for changes
83
+ run: |
84
+ if echo "$DIFF" | grep -q "src/my_folder"; then
85
+ echo "Changes detected in src/my_folder"
86
+ else
87
+ echo "No changes in src/my_folder"
88
+ fi
89
+ prevention:
90
+ - "Append `|| true` to any `grep`, `awk`, or other command where a non-zero exit is not an error."
91
+ - "Use `shell: bash {0}` (no `-e`) for steps that need fine-grained exit code handling."
92
+ - "Prefer `grep -q` with `if/else` blocks instead of relying on grep exit codes for flow control."
93
+ - "Test CI scripts locally with `bash -e script.sh` to reproduce the fail-fast behavior."
94
+ - "Use `set -o pipefail` explicitly when you need pipeline failures to surface, and document it."
95
+ docs:
96
+ - url: "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell"
97
+ label: "jobs.<job_id>.steps[*].shell — default shell invocation"
98
+ - url: "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference"
99
+ label: "Exit codes and error action preference"
100
+ - url: "https://stackoverflow.com/questions/73066461/github-actions-why-an-intermediate-command-failure-in-shell-script-would-cause"
101
+ label: "SO: Why an intermediate command failure causes the whole step to fail (17 votes)"
102
+ - url: "https://stackoverflow.com/questions/75419587/does-a-github-action-step-use-set-e-semantics-by-default"
103
+ label: "SO: Does a GitHub action step use set -e semantics by default? (13 votes)"
@@ -0,0 +1,113 @@
1
+ id: runner-environment-138
2
+ title: "npm ci Cross-Platform Lockfile Missing Optional Native Binaries (esbuild, rollup, vite)"
3
+ category: runner-environment
4
+ severity: error
5
+ tags:
6
+ - npm
7
+ - npm-ci
8
+ - esbuild
9
+ - rollup
10
+ - vite
11
+ - optional-dependencies
12
+ - cross-platform
13
+ - lockfile
14
+ - native-binary
15
+ patterns:
16
+ - regex: 'Cannot find module @rollup/rollup-linux-x64'
17
+ flags: 'i'
18
+ - regex: 'You installed esbuild (on|for) another platform'
19
+ flags: 'i'
20
+ - regex: 'Cannot find module @esbuild/linux'
21
+ flags: 'i'
22
+ - regex: 'npm has a bug related to optional dependencies'
23
+ flags: 'i'
24
+ error_messages:
25
+ - "Cannot find module @rollup/rollup-linux-x64-gnu"
26
+ - "Cannot find module @rollup/rollup-linux-x64-musl"
27
+ - "You installed esbuild on another platform than the one you're currently using"
28
+ - "Cannot find module @esbuild/linux-x64"
29
+ - "npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory."
30
+ root_cause: |
31
+ Modern JavaScript bundlers (rollup, vite, esbuild, SWC, Turbopack) ship platform-
32
+ specific optional native binaries as separate npm packages — e.g.,
33
+ `@rollup/rollup-linux-x64-gnu`, `@esbuild/darwin-arm64`, `@esbuild/linux-x64`.
34
+
35
+ When a developer runs `npm install` on macOS (darwin-arm64 or darwin-x64), the
36
+ generated `package-lock.json` records the macOS-specific optional packages but NOT
37
+ the Linux equivalents. GitHub-hosted runners run on Linux. When `npm ci` uses
38
+ this macOS-generated lockfile in CI:
39
+
40
+ 1. `npm ci` correctly installs exactly what's in the lockfile — only the macOS
41
+ native binary entries are present.
42
+ 2. The Linux-specific optional dependency (`@rollup/rollup-linux-x64-gnu`) is
43
+ absent from the lockfile, so `npm ci` never installs it.
44
+ 3. The build step then fails because the required native binary is missing.
45
+
46
+ This was a long-standing npm bug (npm/cli#4828) that was fixed in npm 11.3.0
47
+ (shipped with Node.js 24.0.2). On older npm versions the issue must be worked around.
48
+
49
+ Note: `npm ci` itself succeeds — the failure occurs downstream during the build/test
50
+ step that imports the native module.
51
+ fix: |
52
+ Option 1 (recommended for npm 11.3.0+ / Node.js 24.0.2+):
53
+ Update Node.js to 24.0.2 or npm to 11.3.0+, then regenerate the lockfile with
54
+ `npm install` from scratch. The bug is fixed in this version.
55
+
56
+ Option 2 — Explicitly list the Linux optional dependencies in `package.json`:
57
+ Add all required platform-native packages to the `optionalDependencies` section.
58
+ npm will then include them in the lockfile regardless of the OS where it was generated.
59
+
60
+ Option 3 — Regenerate the lockfile in CI using `npm install --package-lock-only`
61
+ before running `npm ci`. This is slow but guarantees the lockfile matches the runner OS.
62
+
63
+ Option 4 — Use a Linux environment locally (Docker, WSL2, or devcontainer) to
64
+ generate the lockfile so it contains Linux-specific entries.
65
+ fix_code:
66
+ - language: yaml
67
+ label: "Option 2 — Add Linux optional native packages to package.json optionalDependencies"
68
+ code: |
69
+ # In package.json, add the Linux optional dependency explicitly:
70
+ # "optionalDependencies": {
71
+ # "@rollup/rollup-linux-x64-gnu": "*"
72
+ # }
73
+ # Then run npm install locally to regenerate the lockfile.
74
+ # In your workflow, npm ci will now install it on Linux runners.
75
+ jobs:
76
+ build:
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - uses: actions/checkout@v4
80
+ - uses: actions/setup-node@v4
81
+ with:
82
+ node-version: '20'
83
+ cache: 'npm'
84
+ - run: npm ci
85
+ - run: npm run build
86
+ - language: yaml
87
+ label: "Option 1 — Use Node.js 24+ where the bug is fixed"
88
+ code: |
89
+ jobs:
90
+ build:
91
+ runs-on: ubuntu-latest
92
+ steps:
93
+ - uses: actions/checkout@v4
94
+ - uses: actions/setup-node@v4
95
+ with:
96
+ node-version: '24' # npm 11.3.0+ ships with Node 24.0.2+
97
+ cache: 'npm'
98
+ - run: npm ci
99
+ - run: npm run build
100
+ prevention:
101
+ - "Pin your team's lockfile generation to Linux (use devcontainers, Docker, or WSL2 on Windows)."
102
+ - "Upgrade to Node.js 24.0.2+ or npm 11.3.0+ where the optional dependency platform bug is fixed."
103
+ - "If cross-platform lockfiles are unavoidable, explicitly add platform-specific packages to `optionalDependencies` in `package.json`."
104
+ - "After adding `optionalDependencies`, regenerate the lockfile from scratch — delete `package-lock.json` and `node_modules`, then run `npm install`."
105
+ docs:
106
+ - url: "https://stackoverflow.com/questions/79048814/github-action-is-failing-due-to-rollup-rollup-linux-x64-gnu"
107
+ label: "SO: Github Action failing due to @rollup/rollup-linux-x64-gnu (13 votes, 8k views)"
108
+ - url: "https://stackoverflow.com/questions/73139649/you-installed-esbuild-on-another-platform-than-the-one-youre-currently-using"
109
+ label: "SO: You installed esbuild on another platform (36 votes, 51k views)"
110
+ - url: "https://github.com/npm/cli/issues/4828"
111
+ label: "npm/cli#4828 — Optional dependencies not installed for different platform"
112
+ - url: "https://vitejs.dev/guide/troubleshooting#vite-cjs-node-api-deprecated"
113
+ label: "Vite troubleshooting — esbuild platform mismatch"
@@ -0,0 +1,115 @@
1
+ id: triggers-052
2
+ title: "Required Status Check Not Appearing in Branch Protection Dropdown"
3
+ category: triggers
4
+ severity: limitation
5
+ tags:
6
+ - branch-protection
7
+ - required-status-check
8
+ - check-name
9
+ - job-name
10
+ - workflow-name
11
+ - protected-branch
12
+ patterns:
13
+ - regex: 'status check.*not found'
14
+ flags: 'i'
15
+ - regex: 'waiting for status to be reported'
16
+ flags: 'i'
17
+ error_messages:
18
+ - "Waiting for status to be reported"
19
+ - "Required status check is expected — check name not found in the dropdown"
20
+ root_cause: |
21
+ Branch protection required status checks have several constraints that cause them
22
+ to silently not appear in the "Status checks that are required" search dropdown:
23
+
24
+ 1. **Wrong name searched** — The check name in branch protection is the job's
25
+ `name:` field (if set) or the job's YAML key (ID) — NOT the workflow's `name:`
26
+ field. Developers often search for the workflow name and can't find the check.
27
+ For matrix jobs, the check name includes matrix values:
28
+ e.g., `build (ubuntu-latest, 20.x)` not just `build`.
29
+
30
+ 2. **Check must have run recently** — A status check only appears in the dropdown
31
+ after it has completed successfully at least once on that repository within the
32
+ past 7 days. Brand-new workflows that have never been triggered won't show up.
33
+
34
+ 3. **Workflow must target the protected branch** — For PR-triggered checks, the
35
+ workflow must have `on: pull_request: branches: [main]` (or the target branch).
36
+ A workflow that only runs on `push` to feature branches never posts a status
37
+ to main's pull requests.
38
+
39
+ 4. **Paths filters suppressing the check** — If the workflow has `paths:` filters,
40
+ PRs that don't change filtered files never trigger the workflow, so the check
41
+ is absent (causing PRs to be permanently stuck as "Waiting"). This is covered
42
+ separately in `required-status-check-paths-filter-pr-stuck.yml`.
43
+
44
+ All of these issues are silent — no error is shown. The dropdown simply doesn't
45
+ include the expected check name.
46
+ fix: |
47
+ Step 1 — Confirm the exact check name:
48
+ Go to any recently-merged or open PR in the repository. Find the check in the
49
+ PR's "Checks" tab. Copy the exact displayed name — it is the job's `name:` field
50
+ or the YAML job key, not the workflow `name:` at the top of the file.
51
+ For matrix jobs, include the matrix combination: `build (ubuntu-latest, 20.x)`.
52
+
53
+ Step 2 — Trigger the workflow at least once on a PR against the protected branch:
54
+ The check must have a successful run within the past 7 days to appear.
55
+ Create a test PR or push a temporary commit to get the first run.
56
+
57
+ Step 3 — Add a descriptive `name:` to each job that will be a required check.
58
+ This makes the check name human-readable and stable even if you rename the job key.
59
+
60
+ Step 4 — For matrix workflows, consider adding a fanout job (a job that `needs:`
61
+ all matrix jobs) with a simple pass/fail step, and set THAT as the required check.
62
+ This avoids needing to list every matrix combination individually in branch protection.
63
+ fix_code:
64
+ - language: yaml
65
+ label: "Add explicit job name for a stable, searchable required status check name"
66
+ code: |
67
+ jobs:
68
+ build:
69
+ name: "CI Build" # This is the check name in branch protection, NOT 'build'
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ - run: npm ci && npm test
74
+ - language: yaml
75
+ label: "Matrix jobs — add a fanout job to use as the single required check"
76
+ code: |
77
+ jobs:
78
+ test:
79
+ name: "Test (${{ matrix.os }}, Node ${{ matrix.node }})"
80
+ runs-on: ${{ matrix.os }}
81
+ strategy:
82
+ matrix:
83
+ os: [ubuntu-latest, windows-latest]
84
+ node: ['18', '20']
85
+ steps:
86
+ - uses: actions/checkout@v4
87
+ - uses: actions/setup-node@v4
88
+ with:
89
+ node-version: ${{ matrix.node }}
90
+ - run: npm ci && npm test
91
+
92
+ all-tests-pass:
93
+ name: "All Tests Pass" # Set THIS as the required status check
94
+ needs: test
95
+ runs-on: ubuntu-latest
96
+ if: always()
97
+ steps:
98
+ - name: Verify all matrix jobs passed
99
+ run: |
100
+ if [[ "${{ needs.test.result }}" != "success" ]]; then
101
+ echo "One or more test matrix jobs failed"
102
+ exit 1
103
+ fi
104
+ prevention:
105
+ - "Always add a `name:` to jobs that will be required status checks — job IDs change when refactoring."
106
+ - "Trigger the workflow at least once before setting up branch protection, so the check appears in the dropdown."
107
+ - "For matrix jobs, add a dedicated fanout job that passes only when all matrix jobs pass; set it as the required check."
108
+ - "Avoid `paths:` filters on required-check workflows — use them on optional checks only, or use `required-status-check-paths-filter-pr-stuck.yml` workaround."
109
+ docs:
110
+ - url: "https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks"
111
+ label: "GitHub Docs — Troubleshooting required status checks"
112
+ - url: "https://stackoverflow.com/questions/68554735/github-action-status-check-missing-from-the-list-of-checks-in-protected-branch-s"
113
+ label: "SO: Github Action Status check missing from Protected branch settings (75 votes, 29k views)"
114
+ - url: "https://stackoverflow.com/questions/61989951/github-action-workflow-not-running"
115
+ label: "SO: GitHub Action workflow not running (158 votes, 202k views)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htekdev/actions-debugger",
3
- "version": "1.0.75",
3
+ "version": "1.0.76",
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",