Skip to content

Commit 7a9c02e

Browse files
authored
Merge pull request #276 from SolidOS/release
Release hotFix Wait for PR being available
2 parents cdfe560 + a842ce1 commit 7a9c02e

2 files changed

Lines changed: 79 additions & 9 deletions

File tree

release.hotFix.config.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"defaultBranch": "main",
3+
"skipIfNoDiff": true,
4+
"defaultInstall": "npm install",
5+
"defaultTest": "npm test",
6+
"defaultBuild": "npm run build",
7+
"modes": {
8+
"stable": {
9+
"branch": "main",
10+
"versionBump": "patch",
11+
"npmTag": "latest",
12+
"gitTag": true,
13+
"gitPush": true
14+
},
15+
"test": {
16+
"branch": "dev",
17+
"versionBump": "prerelease",
18+
"preid": "test",
19+
"npmTag": "test",
20+
"gitTag": false,
21+
"gitPush": false
22+
}
23+
},
24+
"repos": [
25+
{
26+
"name": "contacts-pane",
27+
"path": "workspaces/contacts-pane",
28+
"repo": "https://github.com/SolidOS/contacts-pane.git",
29+
"afterInstall": [
30+
"npm install solid-ui@latest solid-logic@latest rdflib@latest"
31+
]
32+
},
33+
{
34+
"name": "profile-pane",
35+
"path": "workspaces/profile-pane",
36+
"repo": "https://github.com/SolidOS/profile-pane.git",
37+
"afterInstall": [
38+
"npm install chat-pane@latest contacts-pane solid-ui@latest pane-registry@latest solid-logic@latest rdflib@latest"
39+
]
40+
},
41+
{
42+
"name": "solid-panes",
43+
"path": "workspaces/solid-panes",
44+
"repo": "https://github.com/SolidOS/solid-panes.git",
45+
"afterInstall": [
46+
"npm install activitystreams-pane@latest chat-pane@latest contacts-pane folder-pane@latest issue-pane@latest meeting-pane@latest pane-registry@latest profile-pane source-pane@latest solid-ui solid-logic@latest solid-namespace@latest rdflib@latest"
47+
]
48+
},
49+
{
50+
"name": "mashlib",
51+
"path": "workspaces/mashlib",
52+
"repo": "https://github.com/SolidOS/mashlib.git",
53+
"afterInstall": [
54+
"npm install solid-panes solid-ui@latest solid-logic@latest rdflib@latest"
55+
]
56+
}
57+
]
58+
}

scripts/release-orchestrator.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,22 +461,34 @@ function waitForPRMerge(repoDir, repo, headBranch, baseBranch, dryRun, options =
461461
}
462462

463463
try {
464-
// Find the PR number for this head branch
464+
// Find the PR number for this head branch. Right after gh pr create,
465+
// list/search APIs can lag for a few seconds.
465466
const prQuery = `gh pr list --repo ${slug} --head ${headBranch} --base ${baseBranch} --state open --json number --jq '.[0].number'`;
467+
const prDiscoveryTimeoutMs = options.prDiscoveryTimeoutMs || 2 * 60 * 1000;
468+
const prDiscoveryPollIntervalMs = options.prDiscoveryPollIntervalMs || 5000;
469+
const prDiscoveryStart = Date.now();
466470
let prNumber;
467-
try {
468-
prNumber = parseInt(runQuiet(prQuery, repoDir), 10);
469-
} catch (err) {
470-
if (required) {
471-
throw new Error(`No open PR found for ${headBranch} -> ${baseBranch}`);
471+
472+
while ((Date.now() - prDiscoveryStart) < prDiscoveryTimeoutMs) {
473+
try {
474+
const rawNumber = String(runQuiet(prQuery, repoDir) || '').trim();
475+
prNumber = parseInt(rawNumber, 10);
476+
} catch (err) {
477+
prNumber = NaN;
472478
}
473-
console.log(`No open PR found for ${headBranch} -> ${baseBranch}`);
474-
return { status: 'skip', reason: 'no-pr' };
479+
480+
if (prNumber) {
481+
break;
482+
}
483+
484+
const waitedSeconds = Math.floor((Date.now() - prDiscoveryStart) / 1000);
485+
console.log(` Waiting for PR to appear for ${headBranch} -> ${baseBranch} (${waitedSeconds}s elapsed)...`);
486+
sleepMs(prDiscoveryPollIntervalMs);
475487
}
476488

477489
if (!prNumber) {
478490
if (required) {
479-
throw new Error(`No open PR found for ${headBranch} -> ${baseBranch}`);
491+
throw new Error(`No open PR found for ${headBranch} -> ${baseBranch} after waiting ${Math.floor(prDiscoveryTimeoutMs / 1000)}s`);
480492
}
481493
console.log(`No open PR found for ${headBranch} -> ${baseBranch}`);
482494
return { status: 'skip', reason: 'no-pr' };

0 commit comments

Comments
 (0)