@htekdev/actions-debugger 1.0.117 → 1.0.118

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,130 @@
1
+ id: yaml-syntax-071
2
+ title: 'Duplicate `id:` values within the same job or composite action cause instant
3
+ workflow validation failure'
4
+ category: yaml-syntax
5
+ severity: error
6
+ tags:
7
+ - step-id
8
+ - duplicate
9
+ - validation
10
+ - composite-action
11
+ - copy-paste
12
+ patterns:
13
+ - regex: 'The identifier .* may not be used more than once within the same scope'
14
+ flags: 'i'
15
+ - regex: 'TemplateValidationException.*may not be used more than once'
16
+ flags: 'i'
17
+ error_messages:
18
+ - "The workflow is not valid. .github/workflows/ci.yml (Line: N, Col: N): The identifier 'checkout'
19
+ may not be used more than once within the same scope."
20
+ - "The identifier 'meta' may not be used more than once within the same scope."
21
+ - "GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid."
22
+ root_cause: |
23
+ Step IDs (`id:`) must be unique within a single job or composite action. If two or more
24
+ steps within the same scope share the same `id:` value, GitHub Actions rejects the entire
25
+ workflow before any step runs, throwing a `TemplateValidationException`.
26
+
27
+ Step IDs form the keys of the `steps` context object. Duplicate keys would make
28
+ `${{ steps.checkout.outputs.ref }}` ambiguous — the platform rejects this ambiguity at
29
+ parse time rather than silently choosing one arbitrarily at runtime.
30
+
31
+ The most common root cause is copy-pasting steps within a job — particularly repeating
32
+ `actions/checkout`, `docker/metadata-action`, or `actions/setup-node` blocks — without
33
+ updating or removing the `id:` field on the duplicate. Composite action authors also
34
+ hit this when a second action step is added without checking existing IDs.
35
+
36
+ The error message reports only the SECOND occurrence's line and column, not both —
37
+ making it harder to locate the original conflicting step in long step lists.
38
+ (Tracked as actions/runner#3121 as an open bug requesting improved error reporting.)
39
+ fix: |
40
+ Ensure every step that declares an `id:` uses a unique value within its job or composite
41
+ action scope. Steps that are not referenced by later steps can omit `id:` entirely —
42
+ only steps whose outputs are used in expressions (`${{ steps.X.outputs.Y }}`) need an ID.
43
+ fix_code:
44
+ - language: yaml
45
+ label: 'WRONG — duplicate id: "meta" causes TemplateValidationException'
46
+ code: |
47
+ jobs:
48
+ build:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - name: Extract metadata for Docker Hub
52
+ id: meta # first declaration
53
+ uses: docker/metadata-action@v5
54
+ with:
55
+ images: myorg/myapp
56
+
57
+ - name: Extract metadata for GHCR
58
+ id: meta # DUPLICATE — workflow rejected
59
+ uses: docker/metadata-action@v5
60
+ with:
61
+ images: ghcr.io/myorg/myapp
62
+
63
+ - uses: docker/build-push-action@v6
64
+ with:
65
+ tags: ${{ steps.meta.outputs.tags }}
66
+ - language: yaml
67
+ label: 'RIGHT — unique IDs for each step'
68
+ code: |
69
+ jobs:
70
+ build:
71
+ runs-on: ubuntu-latest
72
+ steps:
73
+ - name: Extract metadata for Docker Hub
74
+ id: meta-dockerhub
75
+ uses: docker/metadata-action@v5
76
+ with:
77
+ images: myorg/myapp
78
+
79
+ - name: Extract metadata for GHCR
80
+ id: meta-ghcr
81
+ uses: docker/metadata-action@v5
82
+ with:
83
+ images: ghcr.io/myorg/myapp
84
+
85
+ - name: Build and push to Docker Hub
86
+ uses: docker/build-push-action@v6
87
+ with:
88
+ tags: ${{ steps.meta-dockerhub.outputs.tags }}
89
+ labels: ${{ steps.meta-dockerhub.outputs.labels }}
90
+
91
+ - name: Build and push to GHCR
92
+ uses: docker/build-push-action@v6
93
+ with:
94
+ tags: ${{ steps.meta-ghcr.outputs.tags }}
95
+ labels: ${{ steps.meta-ghcr.outputs.labels }}
96
+ - language: yaml
97
+ label: 'RIGHT — omit id: on steps whose outputs are never referenced'
98
+ code: |
99
+ jobs:
100
+ build:
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ # No id: needed — outputs not referenced by other steps
105
+
106
+ - uses: actions/setup-node@v4
107
+ with:
108
+ node-version: '20'
109
+ # No id: needed — only referenced outputs need a step id
110
+
111
+ - id: version
112
+ run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
113
+
114
+ - run: echo "Building version ${{ steps.version.outputs.version }}"
115
+ prevention:
116
+ - 'When copy-pasting steps within a job, immediately update or remove the `id:` field on
117
+ the duplicate to avoid the conflict.'
118
+ - 'Use actionlint or a YAML linter locally before pushing — both catch duplicate step IDs
119
+ and report the error with line numbers for both occurrences.'
120
+ - 'Only assign `id:` to steps whose outputs are referenced in expressions elsewhere in the
121
+ job; leave unreferenced steps without `id:`.'
122
+ - 'Apply the same uniqueness rule to composite actions — step IDs within a composite action
123
+ must also be unique within the action file.'
124
+ docs:
125
+ - url: 'https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsid'
126
+ label: 'GitHub Docs: jobs.<job_id>.steps[*].id'
127
+ - url: 'https://github.com/actions/runner/issues/3121'
128
+ label: 'actions/runner#3121 — Request to improve duplicate step ID error message (Jan 2024)'
129
+ - url: 'https://ghlint.twisterrob.net/issues/default/DuplicateStepId/'
130
+ label: 'GH-Lint: DuplicateStepId rule documentation'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htekdev/actions-debugger",
3
- "version": "1.0.117",
3
+ "version": "1.0.118",
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",