Skip to content

Commit 86253da

Browse files
committed
fix(sisyphus): only stage release-related files in release-pr
1 parent a248b83 commit 86253da

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

packages/sisyphus/src/commands/actions/release-pr.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ export class ActionsReleasePrCommand extends BaseCommand {
147147
await this.stashChanges();
148148
await Bun.$`git checkout -B ${RELEASE_BRANCH} origin/${baseBranch}`;
149149

150-
await this.applyReleaseChanges(ctx, stones, packages);
150+
const changedFiles = await this.applyReleaseChanges(ctx, stones, packages);
151151

152-
await Bun.$`git add -A`;
152+
await Bun.$`git add ${changedFiles}`;
153153
await Bun.$`git commit -m ${`${PR_TITLE_PREFIX} prepare release`}`;
154154
await Bun.$`git push -u origin ${RELEASE_BRANCH} --force`;
155155

@@ -164,9 +164,9 @@ export class ActionsReleasePrCommand extends BaseCommand {
164164
await this.stashChanges();
165165
await Bun.$`git checkout -B ${RELEASE_BRANCH} origin/${baseBranch}`;
166166

167-
await this.applyReleaseChanges(ctx, stones, packages);
167+
const changedFiles = await this.applyReleaseChanges(ctx, stones, packages);
168168

169-
await Bun.$`git add -A`;
169+
await Bun.$`git add ${changedFiles}`;
170170

171171
const hasChanges = await Bun.$`git diff --cached --quiet`.nothrow();
172172
if (hasChanges.exitCode !== 0) {
@@ -182,15 +182,20 @@ export class ActionsReleasePrCommand extends BaseCommand {
182182
await Bun.$`git stash --include-untracked`.nothrow();
183183
}
184184

185-
private async applyReleaseChanges(ctx: ReleasePrCtx, stones: Stone[], packages: Package[]) {
185+
private async applyReleaseChanges(ctx: ReleasePrCtx, stones: Stone[], packages: Package[]): Promise<string[]> {
186186
const changelogConfig = ctx.config.get("changelog");
187187
const generator = new ChangelogGenerator(changelogConfig);
188188
const updater = new PackageUpdater();
189+
const sisyphusDir = ctx.config.get("sisyphusDir");
190+
191+
const changedFiles: string[] = [];
189192

190193
await updater.updateAll(packages);
194+
changedFiles.push(...packages.map((p) => p.file));
191195

192196
if (changelogConfig.generate) {
193197
await generator.generate(stones, packages);
198+
changedFiles.push(`**/${changelogConfig.filename}`);
194199
}
195200

196201
const manager = new StoneManager(ctx.config);
@@ -204,6 +209,10 @@ export class ActionsReleasePrCommand extends BaseCommand {
204209
}
205210

206211
ctx.config.set("currentRelease", { packages: packageVersions, stoneIds: stones.map((s) => s.id), timestamp });
212+
213+
changedFiles.push(sisyphusDir);
214+
215+
return changedFiles;
207216
}
208217

209218
private async createPr(title: string, body: string): Promise<{ number: number; url: string }> {

0 commit comments

Comments
 (0)