Skip to content

Commit 432488d

Browse files
committed
push after commit
1 parent 294bf35 commit 432488d

1 file changed

Lines changed: 40 additions & 10 deletions

File tree

src/test/integration/git.test.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const makeFileChanges = async (
8888
| "with-included-invalid-symlink"
8989
| "with-unchanged-symlink"
9090
| "with-changed-symlink",
91+
branch: string,
9192
) => {
9293
// Update an existing file
9394
await fs.promises.writeFile(
@@ -210,6 +211,25 @@ const makeFileChanges = async (
210211
force: true,
211212
});
212213

214+
// Push the commit with symlink to GitHub so the API can use it as base.
215+
// Using native git since isomorphic-git push requires explicit auth setup.
216+
await new Promise<void>((resolve, reject) => {
217+
const p = execFile(
218+
"git",
219+
["push", "origin", `HEAD:refs/heads/${branch}`],
220+
{ cwd: repoDirectory },
221+
(error) => {
222+
if (error) {
223+
reject(error);
224+
} else {
225+
resolve();
226+
}
227+
},
228+
);
229+
p.stdout?.pipe(process.stdout);
230+
p.stderr?.pipe(process.stderr);
231+
});
232+
213233
if (changegroup === "with-changed-symlink") {
214234
await fs.promises.rm(path.join(repoDirectory, "some-dir", "nested"));
215235
await fs.promises.symlink(
@@ -344,7 +364,7 @@ describe("git", () => {
344364
p.stderr?.pipe(process.stderr);
345365
});
346366

347-
await makeFileChanges(repoDirectory, group);
367+
await makeFileChanges(repoDirectory, group, branch);
348368

349369
// Push the changes
350370
await commitChangesFromRepo({
@@ -402,7 +422,9 @@ describe("git", () => {
402422
p.stderr?.pipe(process.stderr);
403423
});
404424

405-
await makeFileChanges(repoDirectory, "with-unchanged-symlink");
425+
await makeFileChanges(repoDirectory, "with-unchanged-symlink", branch);
426+
427+
await waitForGitHubToBeReady();
406428

407429
await commitChangesFromRepo({
408430
octokit,
@@ -444,7 +466,7 @@ describe("git", () => {
444466
p.stderr?.pipe(process.stderr);
445467
});
446468

447-
await makeFileChanges(repoDirectory, "with-changed-symlink");
469+
await makeFileChanges(repoDirectory, "with-changed-symlink", branch);
448470

449471
await expect(() =>
450472
commitChangesFromRepo({
@@ -489,7 +511,11 @@ describe("git", () => {
489511
p.stderr?.pipe(process.stderr);
490512
});
491513

492-
await makeFileChanges(repoDirectory, "with-included-invalid-symlink");
514+
await makeFileChanges(
515+
repoDirectory,
516+
"with-included-invalid-symlink",
517+
branch,
518+
);
493519

494520
// Push the changes
495521
await expect(() =>
@@ -534,7 +560,11 @@ describe("git", () => {
534560
p.stderr?.pipe(process.stderr);
535561
});
536562

537-
await makeFileChanges(repoDirectory, "with-included-valid-symlink");
563+
await makeFileChanges(
564+
repoDirectory,
565+
"with-included-valid-symlink",
566+
branch,
567+
);
538568

539569
// Push the changes
540570
await expect(() =>
@@ -580,7 +610,7 @@ describe("git", () => {
580610
p.stderr?.pipe(process.stderr);
581611
});
582612

583-
await makeFileChanges(repoDirectory, "with-executable-file");
613+
await makeFileChanges(repoDirectory, "with-executable-file", branch);
584614

585615
// Push the changes
586616
await expect(() =>
@@ -625,7 +655,7 @@ describe("git", () => {
625655
p.stderr?.pipe(process.stderr);
626656
});
627657

628-
makeFileChanges(repoDirectory, "standard");
658+
makeFileChanges(repoDirectory, "standard", branch);
629659

630660
// Determine the previous commit hash
631661
const gitLog = await git.log({
@@ -692,7 +722,7 @@ describe("git", () => {
692722
p.stderr?.pipe(process.stderr);
693723
});
694724

695-
await makeFileChanges(repoDirectory, "standard");
725+
await makeFileChanges(repoDirectory, "standard", branch);
696726

697727
// Push the changes
698728
await commitChangesFromRepo({
@@ -760,7 +790,7 @@ describe("git", () => {
760790
p.stderr?.pipe(process.stderr);
761791
});
762792

763-
await makeFileChanges(repoDirectory, "standard");
793+
await makeFileChanges(repoDirectory, "standard", branch);
764794

765795
// Push the changes
766796
await commitChangesFromRepo({
@@ -825,7 +855,7 @@ describe("git", () => {
825855
p.stderr?.pipe(process.stderr);
826856
});
827857

828-
await makeFileChanges(repoDirectory, "standard");
858+
await makeFileChanges(repoDirectory, "standard", branch);
829859

830860
// Push the changes
831861
await commitChangesFromRepo({

0 commit comments

Comments
 (0)