Skip to content

Commit 64dbf2b

Browse files
Copilotpelikhan
andauthored
fix: tighten SHA regex in test and use -F for multi-line commit message
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9c5e299c-424a-49f8-bf1e-720f35988603 Co-authored-by: pelikhan <[email protected]>
1 parent 3178de1 commit 64dbf2b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

actions/setup/js/push_signed_commits.test.cjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ describe("push_signed_commits integration tests", () => {
992992
expect(githubClient.graphql).not.toHaveBeenCalled();
993993

994994
// Warning about the merge commit must be emitted
995-
expect(mockCore.warning).toHaveBeenCalledWith(expect.stringMatching(/merge commit [0-9a-f]+ detected/));
995+
expect(mockCore.warning).toHaveBeenCalledWith(expect.stringMatching(/merge commit [0-9a-f]{7,40} detected/));
996996
expect(mockCore.warning).toHaveBeenCalledWith(expect.stringContaining("falling back to git push"));
997997

998998
// All commits (including the merge commit) must be present on the remote via git push
@@ -1008,7 +1008,10 @@ describe("push_signed_commits integration tests", () => {
10081008
execGit(["checkout", "-b", "tricky-message-branch"], { cwd: workDir });
10091009
fs.writeFileSync(path.join(workDir, "tricky.txt"), "tricky content\n");
10101010
execGit(["add", "tricky.txt"], { cwd: workDir });
1011-
execGit(["commit", "-m", "Normal headline\n\nparent this line starts with parent but is not a git parent header"], { cwd: workDir });
1011+
// Write the multi-line commit message to a file to avoid shell interpretation issues
1012+
const msgFile = path.join(workDir, ".git", "TRICKY_MSG");
1013+
fs.writeFileSync(msgFile, "Normal headline\n\nparent this line starts with parent but is not a git parent header\n");
1014+
execGit(["commit", "-F", msgFile], { cwd: workDir });
10121015
execGit(["push", "-u", "origin", "tricky-message-branch"], { cwd: workDir });
10131016

10141017
global.exec = makeRealExec(workDir);

0 commit comments

Comments
 (0)