Skip to content

Commit f929ac2

Browse files
committed
chore: fix-local-release
disable changelog generation in local release, which requires a GH token.
1 parent e644572 commit f929ac2

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

tools/release/commands/commands.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Effect, Stream, Console } from 'effect';
22
import { Command } from '@effect/platform';
3+
import { FileSystem, Path } from '@effect/platform';
34

45
export const buildPackages = Command.make('pnpm', 'build').pipe(
56
Command.string,
@@ -26,14 +27,31 @@ export const checkGitStatus = Command.make('git', 'status', '--porcelain').pipe(
2627
Effect.asVoid, // Don't need the output on success
2728
);
2829

30+
/**
31+
* Temporarily disables the GitHub changelog in `.changeset/config.json` so that
32+
* `changeset version` can run without requiring a GITHUB_TOKEN. The existing
33+
* `restoreGitFiles` step at the end of the release pipeline reverts this change.
34+
*/
35+
const disableGitHubChangelog = Effect.gen(function* () {
36+
const fs = yield* FileSystem.FileSystem;
37+
const path = yield* Path.Path;
38+
39+
const configPath = path.join(process.cwd(), '.changeset', 'config.json');
40+
const raw = yield* fs.readFileString(configPath);
41+
const config: Record<string, unknown> = JSON.parse(raw);
42+
43+
config.changelog = false;
44+
45+
yield* fs.writeFileString(configPath, JSON.stringify(config, null, 2) + '\n');
46+
yield* Console.log('Disabled GitHub changelog for snapshot versioning.');
47+
});
48+
2949
// Effect to run changesets snapshot
30-
export const runChangesetsSnapshot = Command.make(
31-
'pnpm',
32-
'changeset',
33-
'version',
34-
'--snapshot',
35-
'beta',
36-
).pipe(Command.exitCode);
50+
export const runChangesetsSnapshot = disableGitHubChangelog.pipe(
51+
Effect.flatMap(() =>
52+
Command.make('pnpm', 'changeset', 'version', '--snapshot', 'beta').pipe(Command.exitCode),
53+
),
54+
);
3755

3856
// Effect to start local registry (run in background)
3957
export const startLocalRegistry = Command.make('pnpm', 'nx', 'local-registry').pipe(

0 commit comments

Comments
 (0)