Skip to content

Commit 08a9f16

Browse files
rqbazanclaude
andauthored
refactor: migrate Node actions to runs.using=node24 + monorepo build pipeline (#16)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8c32e31 commit 08a9f16

39 files changed

Lines changed: 2261 additions & 834 deletions
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Check actions dist sync
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "actions/*/src/**"
7+
- "actions/*/package.json"
8+
- "actions/*/package-lock.json"
9+
- "actions/*/tsconfig.json"
10+
- "actions/*/mise.toml"
11+
- "mise.toml"
12+
13+
jobs:
14+
verify:
15+
runs-on: ubuntu-latest
16+
env:
17+
MISE_EXPERIMENTAL: "1"
18+
steps:
19+
- name: ⬇️ Checkout repo
20+
uses: actions/checkout@v4
21+
22+
- name: 🛠️ Setup mise
23+
uses: jdx/mise-action@v2
24+
with:
25+
install: true
26+
cache: true
27+
experimental: true
28+
29+
- name: 📦 Install deps
30+
run: mise run setup
31+
32+
- name: 🔨 Build all actions
33+
run: mise run build
34+
35+
- name: 🧪 Verify dist is in sync with src
36+
run: |
37+
if ! git diff --exit-code 'actions/*/dist'; then
38+
echo "::error::dist/ is out of sync with src/. Run 'mise run build' locally and commit the result."
39+
git diff 'actions/*/dist' | head -200
40+
exit 1
41+
fi

.gitignore

Lines changed: 10 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,19 @@
1-
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2-
3-
# Logs
4-
5-
logs
6-
_.log
7-
npm-debug.log_
8-
yarn-debug.log*
9-
yarn-error.log*
10-
lerna-debug.log*
11-
.pnpm-debug.log*
12-
13-
# Caches
14-
15-
.cache
16-
.turbo
17-
18-
# Diagnostic reports (https://nodejs.org/api/report.html)
19-
20-
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
21-
22-
# Runtime data
23-
24-
pids
25-
_.pid
26-
_.seed
27-
*.pid.lock
28-
29-
# Directory for instrumented libs generated by jscoverage/JSCover
30-
31-
lib-cov
32-
33-
# Coverage directory used by tools like istanbul
34-
35-
coverage
36-
*.lcov
37-
38-
# nyc test coverage
39-
40-
.nyc_output
41-
42-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
43-
44-
.grunt
45-
46-
# Bower dependency directory (https://bower.io/)
47-
48-
bower_components
49-
50-
# node-waf configuration
51-
52-
.lock-wscript
53-
54-
# Compiled binary addons (https://nodejs.org/api/addons.html)
55-
56-
build/Release
57-
58-
# Dependency directories
59-
1+
# Dependencies
602
node_modules/
61-
jspm_packages/
62-
63-
# Snowpack dependency directory (https://snowpack.dev/)
64-
65-
web_modules/
66-
67-
# TypeScript cache
68-
69-
*.tsbuildinfo
70-
71-
# Optional npm cache directory
72-
73-
.npm
74-
75-
# Optional eslint cache
76-
77-
.eslintcache
78-
79-
# Optional stylelint cache
80-
81-
.stylelintcache
82-
83-
# Microbundle cache
84-
85-
.rpt2_cache/
86-
.rts2_cache_cjs/
87-
.rts2_cache_es/
88-
.rts2_cache_umd/
893

90-
# Optional REPL history
91-
92-
.node_repl_history
93-
94-
# Output of 'npm pack'
95-
96-
*.tgz
97-
98-
# Yarn Integrity file
99-
100-
.yarn-integrity
101-
102-
# dotenv environment variable files
4+
# Logs
5+
*.log
1036

7+
# Env
1048
.env
105-
.env.development.local
106-
.env.test.local
107-
.env.production.local
1089
.env.local
10+
.env.*.local
10911

110-
# parcel-bundler cache (https://parceljs.org/)
111-
112-
.parcel-cache
113-
114-
# Next.js build output
115-
116-
.next
117-
out
118-
119-
# Nuxt.js build / generate output
120-
121-
.nuxt
122-
123-
# Gatsby files
124-
125-
# Comment in the public line in if your project uses Gatsby and not Next.js
126-
127-
# https://nextjs.org/blog/next-9-1#public-directory-support
128-
129-
# public
130-
131-
# vuepress build output
132-
133-
.vuepress/dist
134-
135-
# vuepress v2.x temp and cache directory
136-
137-
.temp
138-
139-
# Docusaurus cache and generated files
140-
141-
.docusaurus
142-
143-
# Serverless directories
144-
145-
.serverless/
146-
147-
# FuseBox cache
148-
149-
.fusebox/
150-
151-
# DynamoDB Local files
152-
153-
.dynamodb/
154-
155-
# TernJS port file
156-
157-
.tern-port
158-
159-
# Stores VSCode versions used for testing VSCode extensions
160-
161-
.vscode-test
162-
163-
# yarn v2
164-
165-
.yarn/cache
166-
.yarn/unplugged
167-
.yarn/build-state.yml
168-
.yarn/install-state.gz
169-
.pnp.*
170-
171-
# IntelliJ based IDEs
172-
.idea
173-
174-
# Finder (MacOS) folder config
12+
# OS
17513
.DS_Store
17614

177-
# Bun
15+
# TypeScript
16+
*.tsbuildinfo
17817

179-
*.bun-build
18+
# mise local overrides
19+
mise.local.toml

README.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
1-
# Github Actions
1+
# Variable Land — GitHub Actions
22

3-
## List
3+
Reusable GitHub Actions used across Variable Land projects.
44

5-
- [Setup pnpm](./actions/setup-pnpm/README.md)
6-
- [Setup bun](./actions/setup-bun/README.md)
7-
- [Setup pnpm + bun](./actions/setup-pnpm-bun/README.md)
8-
- [Monorepo preview release](./actions/monorepo-preview-release/README.md)
9-
- [Railway redeploy](./actions/railway-redeploy/README.md)
5+
## Actions
6+
7+
| Action | Description |
8+
| --- | --- |
9+
| [`monorepo-preview-release`](./actions/monorepo-preview-release/README.md) | Publish a per-PR preview release of changed packages in a pnpm monorepo to npm (OIDC-first, with optional `NPM_TOKEN` fallback) and notify [`vland-bot`](https://bot.variable.land) so it can comment on the PR. |
10+
| [`railway-redeploy`](./actions/railway-redeploy/README.md) | Trigger a redeploy of a Railway service via the Railway GraphQL API. Resolves the target service from `project_id` + `environment` + `service_name`, so no service ID lookup is needed. |
11+
| [`setup-pnpm`](./actions/setup-pnpm/README.md) | Install pnpm, upgrade npm, cache the pnpm store, and install dependencies. |
12+
| [`setup-bun`](./actions/setup-bun/README.md) | Install Bun pinned to the version in `.bun-version`. |
13+
| [`setup-pnpm-bun`](./actions/setup-pnpm-bun/README.md) | Combined `setup-pnpm` + `setup-bun` for workflows that need both runtimes. |
14+
15+
## Versioning
16+
17+
Pin actions to a tag or commit SHA when you need stability:
18+
19+
```yml
20+
uses: variableland/gh-actions/actions/<action-name>@<tag-or-sha>
21+
```
22+
23+
`@main` tracks the latest changes on the default branch.
24+
25+
## Node action convention
26+
27+
Every Node-based action in this monorepo follows the same shape:
28+
29+
1. **`action.yml`** declares `runs.using: node24` and `main: dist/index.js`.
30+
2. **Source** lives in `src/`. The bundled output (`dist/index.js`) is committed to the repo and runs directly on the GitHub Actions runner — no Docker build, no install at runtime.
31+
3. **`mise.toml`** declares a `build` task that runs `ncc build src/index.ts -o dist`. Mise's incremental `sources`/`outputs` tracking skips the rebuild when nothing has changed.
32+
4. The **lefthook `pre-push` hook** runs `mise run build` for any push that touches `actions/*/src/**` and blocks the push if `dist/` is out of sync with `src/`.
33+
5. The CI workflow **`Check actions dist sync`** enforces the same invariant on every PR and is required by branch protection. Anyone who bypasses the local hook still gets caught here.
34+
35+
To add a new Node action, copy the structure of `monorepo-preview-release` or `railway-redeploy`, adjust inputs and logic, and run `mise run build` (or just `git push` — the hook will do it for you and tell you to commit the dist change).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# TypeScript
5+
*.tsbuildinfo

0 commit comments

Comments
 (0)