Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .cursor/rules/github-actions.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
description: Pin GitHub Actions to Node 24-compatible commit SHAs (not version tags)
globs: .github/workflows/**/*.{yml,yaml}
alwaysApply: false
---

# GitHub Actions — Node 24 and SHA pinning

When you **create or change** any file under `.github/workflows/` (or composite/reusable actions under `.github/actions/`):

## 1. Use Node 24–compatible action majors

GitHub deprecated Node 20 for JavaScript actions. Do **not** use older majors that still target Node 20:

| Action | Do not use | Use instead |
|--------|------------|-------------|
| `actions/checkout` | v4 and below | **v6** |
| `actions/setup-node` | v4 and below | **v6** |
| `actions/setup-python` | v5 and below | **v6** |
| `actions/upload-artifact` | v4 and below | **v7** |
| `actions/download-artifact` | v4 and below | **v8** |
| `actions/cache` | v4 and below | **v5** |

Apply the same rule to other official `actions/*` helpers: pick the current major whose `action.yml` declares `using: node24`.

## 2. Pin every `uses:` to a commit SHA

- **Never** leave floating refs: `@v6`, `@v4`, `@main`, branch names, or tags alone.
- **Always** use the 40-character commit SHA, with the human-readable version in a trailing comment.

```yaml
# Bad
uses: actions/checkout@v6

# Good
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
```

Preferred SHAs for common official actions (update when bumping):

```yaml
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
```

Resolve newer SHAs from the latest patch tag on the major line:

```bash
gh api "repos/actions/checkout/git/ref/tags/v6.0.3" -q '.object.sha'
# If type is "tag", dereference: gh api "repos/actions/checkout/git/tags/SHA" -q '.object.sha'
```

Apply the same SHA-pinning rule to third-party actions (`uses: org/action@sha # vX.Y.Z`).

## 3. Run actionlint before finishing

```bash
actionlint .github/workflows/*.yml
```

Fix all errors and warnings; re-run until exit code 0.

## 4. Completion checklist

- [ ] Official actions use Node 24–compatible majors (v6/v7/v8/v5 as above)
- [ ] Every `uses:` references a full commit SHA (not a tag/branch)
- [ ] Version comments match the resolved release (e.g. `# v6.0.3`)
- [ ] `actionlint` passes on changed workflows
4 changes: 2 additions & 2 deletions .github/workflows/proxy_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Set up Node
uses: actions/setup-node@v4
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: "22"
cache: npm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event_name == 'workflow_run' && 'main' || github.event_name == 'release' && github.ref || 'main' }}

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
# the toolcache `npm` binary on GitHub-hosted runners, so `npm publish` stayed on 10.x and OIDC trusted publishing never ran.
- name: Setup Node
if: steps.gate.outputs.publish == 'true'
uses: actions/setup-node@v6
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
cache: npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout merge commit
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.