Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 11 additions & 35 deletions .github/workflows/internal-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,41 +87,17 @@ jobs:

- name: Wait for Internal Tests to complete
if: steps.filter.outputs.non_docs == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
script: |
const targetOwner = process.env.TARGET_OWNER;
const targetRepo = process.env.TARGET_REPO;
const runId = Number(`${{ steps.dispatch.outputs.run_id }}`);
const runUrl = `${{ steps.dispatch.outputs.run_url }}`;
const sleep = (ms) => new Promise(r => setTimeout(r, ms));

core.info(`Waiting for workflow result... ${runUrl}`);

let conclusion = null;
for (let attempt = 0; attempt < 240; attempt++) { // up to ~2 hours
const runResp = await github.rest.actions.getWorkflowRun({
owner: targetOwner,
repo: targetRepo,
run_id: runId
});
const { status, conclusion: c } = runResp.data;
if (status === 'completed') {
conclusion = c || 'success';
break;
}
await sleep(30000);
}

if (!conclusion) {
core.setFailed('Timed out waiting for private workflow to complete.');
return;
}

if (conclusion !== 'success') {
core.setFailed(`Private workflow failed with conclusion: ${conclusion}`);
}
env:
GH_TOKEN: ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
RUN_ID: ${{ steps.dispatch.outputs.run_id }}
RUN_URL: ${{ steps.dispatch.outputs.run_url }}
run: |
set -euo pipefail
echo "Waiting for workflow result... ${RUN_URL}"
gh run watch "$RUN_ID" \
--repo "$TARGET_OWNER/$TARGET_REPO" \
--exit-status \
--interval 30

- name: Cancel invoked run if workflow cancelled
if: ${{ cancelled() && steps.dispatch.outputs.run_id }}
Expand Down
Loading