@htekdev/actions-debugger 1.0.72 → 1.0.73

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,102 @@
1
+ id: silent-failures-070
2
+ title: 'github.ref_name returns N/merge on pull_request events, not the head branch name'
3
+ category: silent-failures
4
+ severity: silent-failure
5
+ tags:
6
+ - github-ref-name
7
+ - github-head-ref
8
+ - pull-request
9
+ - merge-ref
10
+ - branch-name
11
+ - context
12
+ patterns:
13
+ - regex: 'github\.ref_name'
14
+ flags: 'i'
15
+ - regex: '\d+/merge'
16
+ flags: ''
17
+ error_messages:
18
+ - "branch name is '15/merge' instead of 'feature/my-branch'"
19
+ - "invalid branch: 45/merge"
20
+ - "ref_name evaluates to 23/merge on pull_request trigger"
21
+ root_cause: |
22
+ On pull_request events, GitHub creates a synthetic merge commit ref at refs/pull/N/merge
23
+ representing the result of merging the head branch into the base branch. This is the ref
24
+ that the runner checks out by default.
25
+
26
+ github.ref resolves to 'refs/pull/N/merge' and github.ref_name resolves to 'N/merge'
27
+ (e.g., '15/merge') — not the human-readable head branch name.
28
+
29
+ Developers who use github.ref_name expecting the PR head branch name receive the synthetic
30
+ merge ref slug instead, which breaks:
31
+ - Branch-based deployment logic
32
+ - Conditional workflow steps that check the branch name
33
+ - Tag/release workflows incorrectly applied to PR builds
34
+ - Docker image tags derived from the branch name
35
+
36
+ To get the actual PR head branch name on pull_request events, use github.head_ref.
37
+ To get the base branch name, use github.base_ref.
38
+
39
+ Note: On push events, github.ref_name correctly returns the branch name (e.g., 'main').
40
+ The discrepancy only affects pull_request (and pull_request_target) events.
41
+ fix: |
42
+ Use github.head_ref instead of github.ref_name when you need the PR head branch name.
43
+
44
+ For robust multi-event workflows, use a conditional expression:
45
+ - On pull_request: github.head_ref contains the branch name
46
+ - On push: github.ref_name contains the branch name
47
+
48
+ Or use a ternary-style expression to normalize:
49
+ ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
50
+ fix_code:
51
+ - language: yaml
52
+ label: 'Use github.head_ref for PR branch name, github.ref_name for push'
53
+ code: |
54
+ jobs:
55
+ build:
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - name: Get branch name
59
+ run: |
60
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
61
+ BRANCH="${{ github.head_ref }}"
62
+ else
63
+ BRANCH="${{ github.ref_name }}"
64
+ fi
65
+ echo "Branch: $BRANCH"
66
+ echo "BRANCH=$BRANCH" >> $GITHUB_ENV
67
+
68
+ - language: yaml
69
+ label: 'Normalize branch name in Docker image tag (works for push and PR)'
70
+ code: |
71
+ on:
72
+ push:
73
+ branches: [main, develop]
74
+ pull_request:
75
+
76
+ jobs:
77
+ docker:
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - name: Set branch slug
81
+ id: branch
82
+ run: |
83
+ # Use head_ref for PRs, ref_name for push events
84
+ BRANCH="${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}"
85
+ # Slugify: replace / with - for Docker tag compatibility
86
+ SLUG=$(echo "$BRANCH" | tr '/' '-' | tr '[:upper:]' '[:lower:]')
87
+ echo "slug=$SLUG" >> $GITHUB_OUTPUT
88
+
89
+ - name: Build Docker image
90
+ run: docker build -t myapp:${{ steps.branch.outputs.slug }} .
91
+ prevention:
92
+ - 'On pull_request events, always use github.head_ref for the PR head branch and github.base_ref for the target base branch'
93
+ - 'github.ref_name is only reliable as a branch name on push events — never use it unconditionally'
94
+ - 'When writing multi-event workflows (push + pull_request), add an event-conditional expression to normalize the branch name'
95
+ - 'Test workflows triggered by both push and pull_request events to catch context differences early'
96
+ docs:
97
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context'
98
+ label: 'GitHub context — github.ref_name, github.head_ref, github.base_ref'
99
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request'
100
+ label: 'pull_request event context and merge ref behavior'
101
+ - url: 'https://github.com/orgs/community/discussions/25722'
102
+ label: 'GitHub Community: github.ref_name returns N/merge on pull_request'
@@ -0,0 +1,93 @@
1
+ id: silent-failures-069
2
+ title: 'workflow_call: caller env vars not forwarded to reusable workflow — silently unavailable'
3
+ category: silent-failures
4
+ severity: silent-failure
5
+ tags:
6
+ - reusable-workflow
7
+ - workflow_call
8
+ - env-context
9
+ - caller-env
10
+ - inputs
11
+ - environment-variables
12
+ patterns:
13
+ - regex: 'env\.\w+ is not defined'
14
+ flags: 'i'
15
+ - regex: '\$\{\{\s*env\.\w+\s*\}\}\s*$'
16
+ flags: 'im'
17
+ error_messages:
18
+ - "env.API_URL is not defined"
19
+ - "The template is not valid. .github/workflows/deploy.yml: env.BASE_URL is not defined"
20
+ root_cause: |
21
+ GitHub Actions reusable workflows (on.workflow_call) run in a completely isolated environment.
22
+ The caller workflow's env: context — whether defined at the top-level workflow scope or at the
23
+ calling job scope — is NOT automatically forwarded to the called reusable workflow.
24
+
25
+ Only two mechanisms exist for passing data into a reusable workflow:
26
+ - inputs: (on.workflow_call.inputs) for plain values
27
+ - secrets: (on.workflow_call.secrets) for sensitive values
28
+
29
+ A common mistake is defining env: vars at the caller workflow level and assuming they will be
30
+ visible inside the reusable workflow. They are not. The called workflow has its own empty env:
31
+ context (unless vars.* or env: is set within the reusable workflow itself).
32
+
33
+ Example that breaks silently:
34
+ - Caller sets: env: { API_URL: 'https://api.example.com' }
35
+ - Caller calls: uses: ./.github/workflows/deploy.yml
36
+ - Inside deploy.yml: run: curl ${{ env.API_URL }} # evaluates to empty string, no error
37
+ fix: |
38
+ Pass values explicitly via the inputs: mechanism on the reusable workflow call.
39
+ Define the input on on.workflow_call.inputs and reference it as inputs.<name> inside the
40
+ called workflow.
41
+
42
+ If many env vars need forwarding, consider using a JSON-encoded input and fromJSON() inside
43
+ the called workflow, or use repository variables (vars.*) which are available in all workflows.
44
+ fix_code:
45
+ - language: yaml
46
+ label: 'Pass caller env var as explicit input to reusable workflow'
47
+ code: |
48
+ # Caller workflow
49
+ jobs:
50
+ deploy:
51
+ uses: ./.github/workflows/deploy.yml
52
+ with:
53
+ api_url: ${{ vars.API_URL }} # or hardcoded value
54
+ secrets: inherit
55
+
56
+ # Reusable workflow: .github/workflows/deploy.yml
57
+ on:
58
+ workflow_call:
59
+ inputs:
60
+ api_url:
61
+ required: true
62
+ type: string
63
+
64
+ jobs:
65
+ run:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - name: Deploy
69
+ run: curl ${{ inputs.api_url }}
70
+
71
+ - language: yaml
72
+ label: 'Use repository variables (vars.*) accessible in all workflows'
73
+ code: |
74
+ # Set API_URL as a repository variable in Settings → Secrets and variables → Actions → Variables
75
+ # Then reference it in the reusable workflow directly:
76
+ jobs:
77
+ run:
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - name: Deploy
81
+ run: curl ${{ vars.API_URL }}
82
+ prevention:
83
+ - 'Never rely on env: vars defined in a caller workflow being available inside a reusable workflow — they are not forwarded'
84
+ - 'Declare all cross-workflow values as on.workflow_call.inputs or on.workflow_call.secrets'
85
+ - 'Use repository/org-level variables (vars.*) for configuration that many workflows need without explicit passing'
86
+ - 'Run actionlint on caller and callee separately — it will flag undefined env references in reusable workflows'
87
+ docs:
88
+ - url: 'https://docs.github.com/en/actions/sharing-automations/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow'
89
+ label: 'Passing inputs and secrets to a reusable workflow'
90
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#using-the-vars-context-to-access-configuration-variable-values'
91
+ label: 'Using repository variables with the vars context'
92
+ - url: 'https://github.com/orgs/community/discussions/26671'
93
+ label: 'GitHub Community: env vars not accessible in reusable workflows'
@@ -0,0 +1,105 @@
1
+ id: triggers-050
2
+ title: 'on.issue_comment does not fire for PR review thread comments — requires pull_request_review_comment'
3
+ category: triggers
4
+ severity: silent-failure
5
+ tags:
6
+ - issue_comment
7
+ - pull_request_review_comment
8
+ - pr-review
9
+ - comment-event
10
+ - trigger
11
+ - chatops
12
+ patterns:
13
+ - regex: 'on:\s*\n\s+issue_comment'
14
+ flags: 'im'
15
+ - regex: 'github\.event_name\s*==\s*[''"]issue_comment[''"]'
16
+ flags: 'i'
17
+ error_messages:
18
+ - "workflow never triggered when commenting on a PR review thread"
19
+ - "issue_comment workflow fires on issue comments but not PR inline review comments"
20
+ root_cause: |
21
+ GitHub Actions has two distinct comment event types that developers frequently confuse:
22
+
23
+ 1. issue_comment — fires when a comment is posted on:
24
+ - The main conversation thread of an issue
25
+ - The main conversation thread of a pull request (PR-as-issue comments)
26
+ It does NOT fire for inline PR code review comments or review summary comments.
27
+
28
+ 2. pull_request_review_comment — fires when a comment is posted on:
29
+ - A specific line of code in a PR diff (inline review comment)
30
+ It does NOT fire for comments on the main PR conversation thread.
31
+
32
+ 3. pull_request_review — fires when:
33
+ - A complete PR review is submitted (including review body, approval, or request-changes)
34
+
35
+ Chatops bots and automation that listen to issue_comment expecting to catch all PR comment
36
+ activity will silently miss all PR code review thread comments. There is no error — the
37
+ workflow simply never fires for that comment type.
38
+
39
+ Similarly, on.pull_request_review_comment will miss all main thread comments on the same PR.
40
+ fix: |
41
+ Choose the correct trigger based on what type of comment you want to react to:
42
+
43
+ - For commands in PR main conversation (/deploy, /approve, etc.): use issue_comment
44
+ - For reactions to inline code review comments: use pull_request_review_comment
45
+ - For reactions to full review submissions (approve, request changes): use pull_request_review
46
+ - For all PR comment activity: use both issue_comment AND pull_request_review_comment
47
+
48
+ Note: on.issue_comment has access to github.event.issue.number for the PR number,
49
+ while on.pull_request_review_comment has access to github.event.pull_request.number.
50
+ fix_code:
51
+ - language: yaml
52
+ label: 'Listen to all PR comment types (main thread + review thread)'
53
+ code: |
54
+ on:
55
+ issue_comment:
56
+ types: [created]
57
+ pull_request_review_comment:
58
+ types: [created]
59
+ pull_request_review:
60
+ types: [submitted]
61
+
62
+ jobs:
63
+ handle-comment:
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - name: Handle comment
67
+ run: |
68
+ if [ "${{ github.event_name }}" = "issue_comment" ]; then
69
+ echo "Main thread comment: ${{ github.event.comment.body }}"
70
+ echo "PR number: ${{ github.event.issue.number }}"
71
+ elif [ "${{ github.event_name }}" = "pull_request_review_comment" ]; then
72
+ echo "Review thread comment: ${{ github.event.comment.body }}"
73
+ echo "PR number: ${{ github.event.pull_request.number }}"
74
+ fi
75
+
76
+ - language: yaml
77
+ label: 'Chatops bot — listen for slash commands on main PR thread only'
78
+ code: |
79
+ on:
80
+ issue_comment:
81
+ types: [created]
82
+
83
+ jobs:
84
+ chatops:
85
+ # Only run for PR comments (issue_comment also fires on plain issues)
86
+ if: github.event.issue.pull_request != null
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - name: Check for slash command
90
+ run: |
91
+ echo "Comment body: ${{ github.event.comment.body }}"
92
+ prevention:
93
+ - 'Distinguish issue_comment (main PR thread) from pull_request_review_comment (inline code review thread) — they never overlap'
94
+ - 'If building a PR chatops bot, filter to PR-only comments by checking github.event.issue.pull_request != null'
95
+ - 'Use pull_request_review for reactions to full review submissions (approve/reject), not pull_request_review_comment'
96
+ - 'Test your trigger by posting comments in BOTH places (main conversation and code review thread) to verify expected behavior'
97
+ docs:
98
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issue_comment'
99
+ label: 'GitHub Docs — issue_comment event'
100
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_review_comment'
101
+ label: 'GitHub Docs — pull_request_review_comment event'
102
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_review'
103
+ label: 'GitHub Docs — pull_request_review event'
104
+ - url: 'https://github.com/orgs/community/discussions/21929'
105
+ label: 'GitHub Community: issue_comment vs pull_request_review_comment confusion'
@@ -0,0 +1,99 @@
1
+ id: yaml-syntax-047
2
+ title: '"You can''t use both ''branches'' and ''branches-ignore''" — combined on same event trigger'
3
+ category: yaml-syntax
4
+ severity: error
5
+ tags:
6
+ - branches
7
+ - branches-ignore
8
+ - trigger-filter
9
+ - validation-error
10
+ - actionlint
11
+ - on-push
12
+ patterns:
13
+ - regex: 'You can''t use both ''branches'' and ''branches-ignore'''
14
+ flags: 'i'
15
+ - regex: "You can't use both 'branches' and 'branches-ignore'"
16
+ flags: 'i'
17
+ - regex: 'branches.*branches-ignore|branches-ignore.*branches'
18
+ flags: 'is'
19
+ error_messages:
20
+ - "You can't use both 'branches' and 'branches-ignore' for the same event."
21
+ - "Invalid workflow file: .github/workflows/ci.yml: You can't use both 'branches' and 'branches-ignore' for the same event."
22
+ root_cause: |
23
+ GitHub Actions validates that branches and branches-ignore are mutually exclusive filters
24
+ on the same trigger event. Using both simultaneously causes a workflow parse error because
25
+ the semantics are contradictory — branches is an allowlist while branches-ignore is a
26
+ denylist, and combining them on the same trigger is undefined behavior.
27
+
28
+ This restriction applies to all events that support branch filtering, including:
29
+ - on.push
30
+ - on.pull_request
31
+ - on.pull_request_target
32
+
33
+ The same restriction applies to paths vs paths-ignore and tags vs tags-ignore.
34
+
35
+ Common mistake patterns:
36
+ - Developer adds branches-ignore: [main] to prevent duplicate runs, forgetting branches is set
37
+ - Developer copies a snippet with branches and adds branches-ignore without removing the original
38
+ - Workflow generated from a template that includes both filters from different sections
39
+
40
+ Note: branches and paths can coexist on the same trigger (both act as allowlists that AND together).
41
+ It is only branches + branches-ignore (or paths + paths-ignore) that conflict.
42
+ fix: |
43
+ Choose one approach and remove the other:
44
+
45
+ Option A — Use branches (allowlist): explicitly list which branches should trigger the workflow.
46
+ Option B — Use branches-ignore (denylist): list which branches should NOT trigger the workflow.
47
+
48
+ To achieve "run on all branches except main and release/*", use branches-ignore.
49
+ To achieve "only run on main and feature/*", use branches.
50
+
51
+ For complex patterns (e.g., "feature/* except feature/skip"), use branches with negation
52
+ via the ! prefix:
53
+ branches:
54
+ - 'feature/**'
55
+ - '!feature/skip-*'
56
+ fix_code:
57
+ - language: yaml
58
+ label: 'Broken — branches and branches-ignore on same event (causes validation error)'
59
+ code: |
60
+ # BROKEN — do not use both on the same event
61
+ on:
62
+ push:
63
+ branches:
64
+ - main
65
+ - 'feature/**'
66
+ branches-ignore: # ERROR: cannot combine with branches
67
+ - 'feature/wip-*'
68
+
69
+ - language: yaml
70
+ label: 'Fixed — use branches with ! negation patterns'
71
+ code: |
72
+ on:
73
+ push:
74
+ branches:
75
+ - main
76
+ - 'feature/**'
77
+ - '!feature/wip-*' # negate specific sub-pattern
78
+
79
+ - language: yaml
80
+ label: 'Fixed — use branches-ignore (denylist) alone'
81
+ code: |
82
+ on:
83
+ push:
84
+ branches-ignore:
85
+ - 'feature/wip-*'
86
+ - 'dependabot/**'
87
+ prevention:
88
+ - 'Never combine branches and branches-ignore on the same trigger event — pick one approach'
89
+ - 'Use branches (allowlist) when only a few branches should trigger; use branches-ignore (denylist) when most branches should trigger'
90
+ - 'To exclude specific patterns from an allowlist, use ! negation prefix inside the branches list'
91
+ - 'Run actionlint in CI to catch this validation error before pushing (actionlint reports it immediately)'
92
+ - 'The same mutual-exclusion rule applies to paths/paths-ignore and tags/tags-ignore'
93
+ docs:
94
+ - url: 'https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#using-filters'
95
+ label: 'Using filters — branches, branches-ignore, and negation patterns'
96
+ - url: 'https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore'
97
+ label: 'Workflow syntax — on.push branches and branches-ignore'
98
+ - url: 'https://rhysd.github.io/actionlint/'
99
+ label: 'actionlint — static checker that catches this error instantly'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htekdev/actions-debugger",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
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",