Skip to content

Commit 5fcb98e

Browse files
committed
fixup
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent 4898cef commit 5fcb98e

File tree

2 files changed

+38
-18
lines changed

2 files changed

+38
-18
lines changed

.claude/skills/github-actions.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,26 @@ if: inputs.enable-signing == 'true'
5757

5858
### GitHub Workflow Commands
5959

60-
Use workflow commands for user-visible messages:
60+
Use workflow commands for user-visible messages with **double colon separator**:
6161

62-
```yaml
63-
# ✅ CORRECT - Shows as annotation in GitHub UI
62+
```bash
63+
# ✅ CORRECT - Double colon (::) separator after title
6464
echo "::notice title=build::Build completed successfully"
6565
echo "::warning title=race-condition::Merge already in progress"
6666
echo "::error title=deployment::Failed to deploy"
6767
68-
# ❌ WRONG - Just logs to console
68+
# ❌ WRONG - Single colon separator
69+
echo "::notice title=build:Build completed" # Missing second ':'
70+
echo "::warning title=x:message" # Won't display correctly
71+
72+
# ❌ WRONG - Just logs to console (no annotation)
6973
echo "Build completed"
7074
```
7175

76+
**Syntax pattern:** `::LEVEL title=TITLE::MESSAGE`
77+
- `LEVEL`: notice, warning, or error
78+
- Double `::` separator is required between title and message
79+
7280
## Security Best Practices
7381

7482
### The secrets[inputs.name] Vulnerability
@@ -427,7 +435,22 @@ Brief description of what the action does.
427435

428436
## Common Gotchas
429437

430-
1. **Boolean input comparisons**: GitHub Actions inputs are strongly typed, with no "JS-like" truthy logic
438+
1. **Workflow command syntax**: GitHub Actions workflow commands require **double colon separator**
439+
```bash
440+
# ✅ CORRECT - Double :: separator
441+
echo "::notice title=success::All tests passed"
442+
echo "::warning title=deprecated::This feature is deprecated"
443+
echo "::error title=failed::Build failed"
444+
445+
# ❌ WRONG - Single : separator (won't display correctly)
446+
echo "::notice title=success:All tests passed"
447+
echo "::warning title=x:message"
448+
449+
# Pattern: ::LEVEL title=TITLE::MESSAGE
450+
# The double :: between title and message is mandatory
451+
```
452+
453+
2. **Boolean input comparisons**: GitHub Actions inputs are strongly typed, with no "JS-like" truthy logic
431454
```yaml
432455
# ❌ WRONG - Boolean true is NOT equal to string 'true'
433456
on:
@@ -448,12 +471,12 @@ Brief description of what the action does.
448471
if [[ '${{ inputs.enable-feature }}' == 'true' ]]; then # Works in bash
449472
```
450473

451-
2. **Expression evaluation in descriptions**: Don't use `${{ }}` in action.yml description fields
452-
3. **Race conditions**: Always use optimistic execution + error handling, never check-then-act
453-
4. **Secret exposure**: Never use `secrets[inputs.name]` - always use explicit secret parameters
454-
5. **Branch deletion**: Use `wait-pending-jobs` before merging to prevent failures in non-required jobs
455-
6. **Idempotency**: `gh pr merge --auto` is NOT idempotent - handle "Merge already in progress" error
456-
7. **TOCTOU vulnerabilities**: State can change between check and action - handle at runtime
474+
3. **Expression evaluation in descriptions**: Don't use `${{ }}` in action.yml description fields
475+
4. **Race conditions**: Always use optimistic execution + error handling, never check-then-act
476+
5. **Secret exposure**: Never use `secrets[inputs.name]` - always use explicit secret parameters
477+
6. **Branch deletion**: Use `wait-pending-jobs` before merging to prevent failures in non-required jobs
478+
7. **Idempotency**: `gh pr merge --auto` is NOT idempotent - handle "Merge already in progress" error
479+
8. **TOCTOU vulnerabilities**: State can change between check and action - handle at runtime
457480

458481
## Testing Workflows
459482

.github/workflows/go-test-monorepo.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
cache-dependency-path: '**/go.sum'
9696
-
9797
name: Detect go version
98-
id: detect-test-work-supported
98+
id: detect-test-work
9999
run: |
100100
go_minor_version=$(echo '${{ steps.go-setup.outputs.go-version }}'|cut -d' ' -f3|cut -d'.' -f2)
101101
echo "go-minor-version=${go_minor_version}" >> "${GITHUB_OUTPUT}"
@@ -113,10 +113,7 @@ jobs:
113113
uses: go-openapi/gh-actions/install/gotestsum@6c7952706aa7afa9141262485767d9270ef5b00b # v1.3.0
114114
-
115115
name: Run unit tests on all modules in this repo (go1.25+ with go.work)
116-
if: >
117-
${{
118-
needs.lint.outputs.is_monorepo == 'true' && steps.detect-test-work-supported.outputs.supported == 'true'
119-
}}
116+
if: ${{ needs.lint.outputs.is_monorepo == 'true' && steps.detect-test-work.outputs.supported == 'true' }}
120117
# with go.work file enabled, go test recognizes sub-modules and collects all packages to be covered
121118
# without specifying -coverpkg.
122119
#
@@ -139,7 +136,7 @@ jobs:
139136
name: Run unit tests on all modules in this repo (<go1.25 or no go.work)
140137
if: >
141138
${{
142-
needs.lint.outputs.is_monorepo == 'true' && steps.detect-test-work-supported.outputs.supported != 'true'
139+
needs.lint.outputs.is_monorepo == 'true' && steps.detect-test-work.outputs.supported != 'true'
143140
}}
144141
run: |
145142
declare -a ALL_MODULES
@@ -166,7 +163,7 @@ jobs:
166163
${ALL_MODULES[@]}
167164
-
168165
name: Run unit tests
169-
if: ${{ needs.lint.outputs.is_monorepo != 'true' && needs.lint.outputs.is_monorepo != true }}
166+
if: ${{ needs.lint.outputs.is_monorepo != 'true' }}
170167
run: >
171168
gotestsum
172169
--jsonfile 'unit.report.${{ matrix.os }}-${{ matrix.go }}.json'

0 commit comments

Comments
 (0)