Skip to content

Commit 9ac8d10

Browse files
committed
fix: update commit message format to exclude PR body for wiki commits
Fixes #95
1 parent d4d71db commit 9ac8d10

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

__tests__/wiki.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ describe('wiki', async () => {
275275
'config --local user.name GitHub Actions',
276276
'config --local user.email 41898282+github-actions[bot]@users.noreply.github.com',
277277
'add .',
278-
'commit -m PR #123 - Test PR title\n\nTest PR body',
278+
'commit -m PR #123 - Test PR title',
279279
'push origin',
280280
]);
281281

@@ -334,7 +334,7 @@ describe('wiki', async () => {
334334

335335
// Verify commit message format
336336
const commitCall = vi.mocked(execFileSync).mock.calls.find((call) => call?.[1]?.includes('commit'));
337-
expect(commitCall?.[1]).toEqual(['commit', '-m', 'PR #456 - Complex PR title\n\nLine 1\nLine 2\nLine 3']);
337+
expect(commitCall?.[1]).toEqual(['commit', '-m', 'PR #456 - Complex PR title']);
338338
});
339339
});
340340

src/wiki.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,14 @@ export function commitAndPushWikiChanges(): void {
515515
startGroup('Committing and pushing changes to wiki');
516516

517517
try {
518-
const { prBody, prNumber, prTitle } = context;
519-
const commitMessage = `PR #${prNumber} - ${prTitle}\n\n${prBody}`.trim();
518+
const { prNumber, prTitle } = context;
519+
520+
// Note: We originally used the PR title and PR body to create the commit message; however, due to the way
521+
// GitHub formats the commits/revision history for the Wiki it's designed to be smaller and thus we use
522+
// the PR title for now.
523+
// Ref: https://github.com/techpivot/terraform-modules-demo/wiki/aws%E2%88%95s3%E2%80%92bucket%E2%80%92object/_history
524+
// Ref: https://github.com/techpivot/terraform-module-releaser/issues/95
525+
const commitMessage = `PR #${prNumber} - ${prTitle}`.trim();
520526
const wikiDirectory = resolve(context.workspaceDir, WIKI_SUBDIRECTORY_NAME);
521527
const execWikiOpts: ExecSyncOptions = { cwd: wikiDirectory, stdio: 'inherit' };
522528
const gitPath = which.sync('git');

0 commit comments

Comments
 (0)