Skip to content

Commit 6f6c74d

Browse files
committed
Add GitHub Actions guidelines to CLAUDE.md
1 parent 629f28c commit 6f6c74d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

CLAUDE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,54 @@ Socket CLI integrates with various third-party tools and services:
284284
- **cdxgen**: CycloneDX BOM generator for creating software bill of materials
285285
- **synp**: Tool for converting between yarn.lock and package-lock.json formats
286286

287+
## 🔧 Git & Workflow
288+
289+
### GitHub Actions Guidelines
290+
- **🚨 MANDATORY**: All GitHub Actions MUST reference commit SHAs, not version tags
291+
- **Security requirement**: SocketDev repositories require pinned commit hashes for supply chain security
292+
- **🚨 MANDATORY**: Reusable workflows MUST be created in `socket-registry/.github/workflows/`, NOT in individual project repositories
293+
- **Workflow location**: Individual projects should reference workflows from `SocketDev/socket-registry/.github/workflows/`
294+
- **Standard action SHAs** (keep these updated across all Socket projects):
295+
- `actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8` (v5.0.0)
296+
- `pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda` (v4.1.0)
297+
- `actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444` (v5.0.0)
298+
- `actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874` (v4.4.0)
299+
- **Format**: Always include version comment: `uses: owner/repo@sha # vX.Y.Z`
300+
- **Examples**:
301+
- ✅ CORRECT: `uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0`
302+
- ✅ CORRECT: `uses: SocketDev/socket-registry/.github/workflows/test.yml@main`
303+
- ❌ FORBIDDEN: `uses: actions/checkout@v4` or `uses: actions/checkout@v5`
304+
- ❌ FORBIDDEN: `uses: ./.github/workflows/_reusable-test.yml` (reusable workflows belong in socket-registry)
305+
- **Allowed actions**: Either SocketDev-owned or pinned by SHA from trusted sources
306+
- **Cross-project consistency**: Maintain identical SHAs across all Socket projects
307+
308+
### CI Workflow Strategy
309+
- **🚨 MANDATORY**: Use the centralized `ci.yml` reusable workflow from socket-registry
310+
- **Workflow location**: `SocketDev/socket-registry/.github/workflows/ci.yml@main`
311+
- **Benefits**: Consistent CI strategy across all Socket projects, parallel execution of lint/type-check/test/coverage
312+
- **Configuration**: Customize via workflow inputs (scripts, node versions, OS versions, timeouts, etc.)
313+
- **Standard configuration pattern**:
314+
```yaml
315+
jobs:
316+
ci:
317+
name: Run CI Pipeline
318+
uses: SocketDev/socket-registry/.github/workflows/ci.yml@main
319+
with:
320+
coverage-script: 'pnpm run test:unit:coverage'
321+
coverage-report-script: 'pnpm run coverage:percent --json'
322+
fail-fast: false
323+
lint-script: 'pnpm run check-ci'
324+
node-versions: '[20, 22, 24]'
325+
os-versions: '["ubuntu-latest", "windows-latest"]'
326+
test-script: 'pnpm run test-ci'
327+
test-setup-script: 'pnpm run build'
328+
type-check-script: 'pnpm run check:tsc'
329+
type-check-setup-script: 'pnpm run build'
330+
```
331+
- **Orchestration**: CI workflow orchestrates lint.yml, types.yml, test.yml, and coverage reporting
332+
- **Individual workflows**: Keep lint.yml, types.yml, test.yml for targeted runs; ci.yml runs all together
333+
- **Cross-project consistency**: All Socket projects should use identical CI orchestration pattern
334+
287335
## 🔧 Code Style (MANDATORY)
288336
289337
### 📁 File Organization & Imports

0 commit comments

Comments
 (0)