Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pr): ensure PR update after branch commit #18839

Merged
merged 28 commits into from Nov 16, 2022
Merged
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8ddc944
if pr creation is not immediate, add another check that PR doesn't al…
PhilipAbed Nov 9, 2022
28ac082
if pr creation is not immediate, add another check that PR doesn't al…
PhilipAbed Nov 10, 2022
5a0ab45
if pr creation is not immediate, add another check that PR doesn't al…
PhilipAbed Nov 10, 2022
f5a6da9
we should skip automerge on artifact errors and user rebase.
PhilipAbed Nov 10, 2022
98b1b30
we should skip automerge on artifact errors and user rebase.
PhilipAbed Nov 10, 2022
4b3cc44
we should skip automerge on artifact errors and user rebase.
PhilipAbed Nov 10, 2022
b0ff438
we should skip automerge on artifact errors and if there's a new commit
PhilipAbed Nov 13, 2022
47a0499
we should skip automerge on artifact errors and if there's a new commit
PhilipAbed Nov 13, 2022
7765635
we should skip automerge on artifact errors and if there's a new commit
PhilipAbed Nov 13, 2022
8c02a48
add unit tests
PhilipAbed Nov 14, 2022
cf805b8
add unit tests
PhilipAbed Nov 14, 2022
b7d6d8c
add unit tests
PhilipAbed Nov 14, 2022
1964e35
fix unit test
PhilipAbed Nov 14, 2022
20110cf
Merge branch 'main' into immediatepr
PhilipAbed Nov 14, 2022
ae8e04c
fix unit test
PhilipAbed Nov 15, 2022
1cdbfdd
Merge remote-tracking branch 'origin/immediatepr' into immediatepr
PhilipAbed Nov 15, 2022
dbc2d05
Merge branch 'main' into immediatepr
PhilipAbed Nov 15, 2022
af8a2aa
fix unit test
PhilipAbed Nov 15, 2022
20ac0aa
fix unit test
PhilipAbed Nov 15, 2022
1e0120b
Merge remote-tracking branch 'origin/immediatepr' into immediatepr
PhilipAbed Nov 15, 2022
d292fe9
fix unit test
PhilipAbed Nov 15, 2022
5f68f3e
Restore ordering
rarkins Nov 16, 2022
4ec4424
restore ordering
rarkins Nov 16, 2022
9c90e67
restore order
rarkins Nov 16, 2022
3c17087
Merge branch 'main' into immediatepr
rarkins Nov 16, 2022
49731f7
Update lib/workers/repository/update/branch/index.ts
rarkins Nov 16, 2022
8ced9d6
minor fix
PhilipAbed Nov 16, 2022
efa1ca0
Merge branch 'main' into immediatepr
PhilipAbed Nov 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions lib/workers/repository/update/branch/index.ts
Expand Up @@ -553,26 +553,29 @@ export async function processBranch(
await setStability(config);
await setConfidence(config);

// break if we pushed a new commit because status check are pretty sure pending but maybe not reported yet
// but do not break when there are artifact errors
if (
const skipCondition =
commitSha &&
!config.artifactErrors?.length &&
!userRebaseRequested &&
PhilipAbed marked this conversation as resolved.
Show resolved Hide resolved
commitSha &&
config.prCreation !== 'immediate'
) {
logger.debug(`Branch status pending, current sha: ${commitSha}`);
config.prCreation !== 'immediate';

// new commit means status check are pretty sure pending but maybe not reported yet
// if PR has not been created + new commit + prCreation !== immediate skip
// but do not break when there are artifact errors
if (skipCondition && !branchPr) {
logger.debug(`Branch status pending, current sha: ${commitSha!}`);
return {
branchExists: true,
updatesVerified,
prNo: branchPr?.number,
result: BranchResult.Pending,
commitSha,
};
}

// Try to automerge branch and finish if successful, but only if branch already existed before this run
if (branchExists || config.ignoreTests) {
// skip if we have a new commit while prCreation != immediate and there is an existing PR,
// we want to update the PR and skip the Auto merge since status checks aren't done yet
if (!skipCondition && (branchExists || config.ignoreTests)) {
const mergeStatus = await tryBranchAutomerge(config);
logger.debug(`mergeStatus=${mergeStatus}`);
if (mergeStatus === 'automerged') {
Expand Down