Skip to content

Commit 09bca44

Browse files
authored
CI - Make Internal Tests less brittle (#3536)
# Description of Changes For some reason, the Internal Tests have trouble fetching the commit sha, especially when the job is re-run. This PR switches it to using ref names rather than commit sha, because the ref names are much more durable than GitHub's ephemeral commits that it generates during workflows. # API and ABI breaking changes None. CI only. # Expected complexity level and risk 1 # Testing - [x] CI still passes - [x] Ref still gets checked out successfully on re-run. --------- Co-authored-by: Zeke Foppa <[email protected]>
1 parent cc73953 commit 09bca44

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/internal-tests.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ jobs:
1919
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
2020
runs-on: ubuntu-latest
2121
steps:
22-
- name: Print current ref and sha
23-
run: |
24-
echo "github.ref=${{ github.ref }}"
25-
echo "github.sha=${{ github.sha }}"
26-
2722
- name: Trigger and wait for Internal Tests
2823
uses: actions/github-script@v7
2924
with:
@@ -33,9 +28,15 @@ jobs:
3328
const targetRepo = 'SpacetimeDBPrivate';
3429
const workflowId = 'internal-tests.yml';
3530
const targetRef = 'master';
36-
const publicRef = context.sha;
31+
// Use the ref for pull requests because the head sha is brittle (github does some extra dance where it merges in master).
32+
const publicRef = (context.eventName === 'pull_request') ? context.payload.pull_request.head.ref : context.sha;
3733
const preDispatch = new Date().toISOString();
3834
35+
console.log("context.eventName =", context.eventName);
36+
console.log("context.ref =", context.ref);
37+
console.log("context.sha =", context.sha);
38+
console.log("Dispatch workflow with publicRef =", publicRef);
39+
3940
// Dispatch the workflow in the target repository
4041
await github.rest.actions.createWorkflowDispatch({
4142
owner: targetOwner,

0 commit comments

Comments
 (0)