Skip to content

Commit 02d325d

Browse files
committed
push after commit
1 parent 294bf35 commit 02d325d

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

src/test/integration/git.test.ts

Lines changed: 32 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,7 @@ describe("git", () => {
489511
p.stderr?.pipe(process.stderr);
490512
});
491513

492-
await makeFileChanges(repoDirectory, "with-included-invalid-symlink");
514+
await makeFileChanges(repoDirectory, "with-included-invalid-symlink", branch);
493515

494516
// Push the changes
495517
await expect(() =>
@@ -534,7 +556,7 @@ describe("git", () => {
534556
p.stderr?.pipe(process.stderr);
535557
});
536558

537-
await makeFileChanges(repoDirectory, "with-included-valid-symlink");
559+
await makeFileChanges(repoDirectory, "with-included-valid-symlink", branch);
538560

539561
// Push the changes
540562
await expect(() =>
@@ -580,7 +602,7 @@ describe("git", () => {
580602
p.stderr?.pipe(process.stderr);
581603
});
582604

583-
await makeFileChanges(repoDirectory, "with-executable-file");
605+
await makeFileChanges(repoDirectory, "with-executable-file", branch);
584606

585607
// Push the changes
586608
await expect(() =>
@@ -625,7 +647,7 @@ describe("git", () => {
625647
p.stderr?.pipe(process.stderr);
626648
});
627649

628-
makeFileChanges(repoDirectory, "standard");
650+
makeFileChanges(repoDirectory, "standard", branch);
629651

630652
// Determine the previous commit hash
631653
const gitLog = await git.log({
@@ -692,7 +714,7 @@ describe("git", () => {
692714
p.stderr?.pipe(process.stderr);
693715
});
694716

695-
await makeFileChanges(repoDirectory, "standard");
717+
await makeFileChanges(repoDirectory, "standard", branch);
696718

697719
// Push the changes
698720
await commitChangesFromRepo({
@@ -760,7 +782,7 @@ describe("git", () => {
760782
p.stderr?.pipe(process.stderr);
761783
});
762784

763-
await makeFileChanges(repoDirectory, "standard");
785+
await makeFileChanges(repoDirectory, "standard", branch);
764786

765787
// Push the changes
766788
await commitChangesFromRepo({
@@ -825,7 +847,7 @@ describe("git", () => {
825847
p.stderr?.pipe(process.stderr);
826848
});
827849

828-
await makeFileChanges(repoDirectory, "standard");
850+
await makeFileChanges(repoDirectory, "standard", branch);
829851

830852
// Push the changes
831853
await commitChangesFromRepo({

0 commit comments

Comments
 (0)