Skip to content

Commit e64c92a

Browse files
Use compact gh run watch in CI
1 parent 984e9d5 commit e64c92a

2 files changed

Lines changed: 22 additions & 36 deletions

File tree

.github/workflows/internal-tests.yml

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -87,41 +87,18 @@ jobs:
8787
8888
- name: Wait for Internal Tests to complete
8989
if: steps.filter.outputs.non_docs == 'true'
90-
uses: actions/github-script@v7
91-
with:
92-
github-token: ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
93-
script: |
94-
const targetOwner = process.env.TARGET_OWNER;
95-
const targetRepo = process.env.TARGET_REPO;
96-
const runId = Number(`${{ steps.dispatch.outputs.run_id }}`);
97-
const runUrl = `${{ steps.dispatch.outputs.run_url }}`;
98-
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
99-
100-
core.info(`Waiting for workflow result... ${runUrl}`);
101-
102-
let conclusion = null;
103-
for (let attempt = 0; attempt < 240; attempt++) { // up to ~2 hours
104-
const runResp = await github.rest.actions.getWorkflowRun({
105-
owner: targetOwner,
106-
repo: targetRepo,
107-
run_id: runId
108-
});
109-
const { status, conclusion: c } = runResp.data;
110-
if (status === 'completed') {
111-
conclusion = c || 'success';
112-
break;
113-
}
114-
await sleep(30000);
115-
}
116-
117-
if (!conclusion) {
118-
core.setFailed('Timed out waiting for private workflow to complete.');
119-
return;
120-
}
121-
122-
if (conclusion !== 'success') {
123-
core.setFailed(`Private workflow failed with conclusion: ${conclusion}`);
124-
}
90+
env:
91+
GH_TOKEN: ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
92+
RUN_ID: ${{ steps.dispatch.outputs.run_id }}
93+
RUN_URL: ${{ steps.dispatch.outputs.run_url }}
94+
run: |
95+
set -euo pipefail
96+
echo "Waiting for workflow result... ${RUN_URL}"
97+
gh run watch "$RUN_ID" \
98+
--repo "$TARGET_OWNER/$TARGET_REPO" \
99+
--exit-status \
100+
--compact \
101+
--interval 30
125102
126103
- name: Cancel invoked run if workflow cancelled
127104
if: ${{ cancelled() && steps.dispatch.outputs.run_id }}

tools/release/src/targets/github_release.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,16 @@ impl GithubRelease {
7070
}
7171

7272
fn wait_for_workflow(&self, run_id: &str) -> Result<(), String> {
73-
let cmd = cmd!("gh", "run", "watch", run_id, "--repo", REPO, "--exit-status");
73+
let cmd = cmd!(
74+
"gh",
75+
"run",
76+
"watch",
77+
run_id,
78+
"--repo",
79+
REPO,
80+
"--exit-status",
81+
"--compact"
82+
);
7483
println!("$> {:?}", cmd);
7584
cmd.run()
7685
.map(|_| ())

0 commit comments

Comments
 (0)