Skip to content

Commit 5ed5a05

Browse files
sentry-junior[bot]junior[bot]claude
authored
feat(cli): scaffold .github/workflows/ci.yml in junior init (#391)
`junior init` now scaffolds a `.github/workflows/ci.yml` so new Junior apps ship with CI validation out of the box. **Scaffolded Workflow** The generated workflow runs on push to `main` and on pull requests with steps: checkout, pnpm 10 setup, Node 24, `pnpm install --frozen-lockfile`, `pnpm check` (validates skills, plugins, and app structure), and `pnpm build`. **pnpm versioning** pnpm version is declared via `pnpm/action-setup`'s `version: 10` input rather than a `packageManager` field in `package.json`. Scaffolded projects don't actively maintain a version pin, so `packageManager` would go stale immediately. Users who want corepack pinning can add it themselves when ready. Fixes #390 --------- Co-authored-by: junior[bot] <junior[bot]@sentry.io> Co-authored-by: Claude (anthropic/claude-opus-4.6) <noreply@anthropic.com> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
1 parent be1f4d5 commit 5ed5a05

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

packages/junior/src/cli/init.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,37 @@ function writeVercelJson(targetDir: string): void {
5656
);
5757
}
5858

59+
function writeGitHubWorkflow(targetDir: string): void {
60+
const workflowDir = path.join(targetDir, ".github", "workflows");
61+
fs.mkdirSync(workflowDir, { recursive: true });
62+
fs.writeFileSync(
63+
path.join(workflowDir, "ci.yml"),
64+
`name: CI
65+
66+
on:
67+
push:
68+
branches: [main]
69+
pull_request:
70+
71+
jobs:
72+
build:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v6
76+
- uses: pnpm/action-setup@v6
77+
with:
78+
version: 10
79+
- uses: actions/setup-node@v6
80+
with:
81+
node-version: 24
82+
cache: pnpm
83+
- run: pnpm install --frozen-lockfile
84+
- run: pnpm check
85+
- run: pnpm build
86+
`,
87+
);
88+
}
89+
5990
export async function runInit(
6091
dir: string,
6192
log: (line: string) => void = console.log,
@@ -158,6 +189,7 @@ SENTRY_ORG_SLUG=
158189
writeNitroConfig(target);
159190
writeViteConfig(target);
160191
writeVercelJson(target);
192+
writeGitHubWorkflow(target);
161193

162194
log(`Created ${name} at ${target}`);
163195
log("");

packages/junior/tests/unit/cli/init-cli.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ describe("init cli", () => {
3434
expect(fs.existsSync(path.join(target, "app", "DESCRIPTION.md"))).toBe(
3535
true,
3636
);
37+
expect(
38+
fs.existsSync(path.join(target, ".github", "workflows", "ci.yml")),
39+
).toBe(true);
40+
41+
const workflow = fs.readFileSync(
42+
path.join(target, ".github", "workflows", "ci.yml"),
43+
"utf8",
44+
);
45+
expect(workflow).toContain("pnpm check");
46+
expect(workflow).toContain("pnpm build");
47+
expect(workflow).toContain("pnpm install --frozen-lockfile");
3748

3849
const vercelConfig = JSON.parse(
3950
fs.readFileSync(path.join(target, "vercel.json"), "utf8"),

0 commit comments

Comments
 (0)