Skip to content

Commit 8e70bc1

Browse files
committed
Add GitHub Actions guidelines to CLAUDE.md
1 parent 44a9f86 commit 8e70bc1

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,52 @@ All code elements MUST be sorted according to these rules for consistency and ma
532532
- Use `--no-verify` flag only when explicitly requested
533533
- Always provide clear, descriptive commit messages
534534
535+
### GitHub Actions Guidelines
536+
- **🚨 MANDATORY**: All GitHub Actions MUST reference commit SHAs, not version tags
537+
- **Security requirement**: SocketDev repositories require pinned commit hashes for supply chain security
538+
- **🚨 MANDATORY**: Reusable workflows MUST be created in `socket-registry/.github/workflows/`, NOT in individual project repositories
539+
- **Workflow location**: Individual projects should reference workflows from `SocketDev/socket-registry/.github/workflows/`
540+
- **Standard action SHAs** (keep these updated across all Socket projects):
541+
- `actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8` (v5.0.0)
542+
- `pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda` (v4.1.0)
543+
- `actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444` (v5.0.0)
544+
- `actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874` (v4.4.0)
545+
- **Format**: Always include version comment: `uses: owner/repo@sha # vX.Y.Z`
546+
- **Examples**:
547+
- ✅ CORRECT: `uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0`
548+
- ✅ CORRECT: `uses: SocketDev/socket-registry/.github/workflows/test.yml@main`
549+
- ❌ FORBIDDEN: `uses: actions/checkout@v4` or `uses: actions/checkout@v5`
550+
- ❌ FORBIDDEN: `uses: ./.github/workflows/_reusable-test.yml` (reusable workflows belong in socket-registry)
551+
- **Allowed actions**: Either SocketDev-owned or pinned by SHA from trusted sources
552+
- **Cross-project consistency**: Maintain identical SHAs across all Socket projects
553+
554+
### CI Workflow Strategy
555+
- **🚨 MANDATORY**: Use the centralized `ci.yml` reusable workflow from socket-registry
556+
- **Workflow location**: `SocketDev/socket-registry/.github/workflows/ci.yml@main`
557+
- **Benefits**: Consistent CI strategy across all Socket projects, parallel execution of lint/type-check/test/coverage
558+
- **Configuration**: Customize via workflow inputs (scripts, node versions, OS versions, timeouts, etc.)
559+
- **Standard configuration pattern**:
560+
```yaml
561+
jobs:
562+
ci:
563+
name: Run CI Pipeline
564+
uses: SocketDev/socket-registry/.github/workflows/ci.yml@main
565+
with:
566+
coverage-script: 'pnpm run test:unit:coverage'
567+
coverage-report-script: 'pnpm run coverage:percent --json'
568+
fail-fast: false
569+
lint-script: 'pnpm run check-ci'
570+
node-versions: '[20, 22, 24]'
571+
os-versions: '["ubuntu-latest", "windows-latest"]'
572+
test-script: 'pnpm run test-ci'
573+
test-setup-script: 'pnpm run build'
574+
type-check-script: 'pnpm run check:tsc'
575+
type-check-setup-script: 'pnpm run build'
576+
```
577+
- **Orchestration**: CI workflow orchestrates lint.yml, types.yml, test.yml, and coverage reporting
578+
- **Individual workflows**: Keep lint.yml, types.yml, test.yml for targeted runs; ci.yml runs all together
579+
- **Cross-project consistency**: All Socket projects should use identical CI orchestration pattern
580+
535581
## 📝 CHANGELOG MANAGEMENT
536582

537583
When updating the changelog (`CHANGELOG.md`):

0 commit comments

Comments
 (0)