@@ -10,22 +10,15 @@ permissions:
1010 contents : read
1111
1212concurrency :
13- # When a PR number isn't available, the event won't be a `pull_request` event so it won't matter.
14- group : ${{ github.workflow }}-${{ github.event.pull_request.number }}
15- # Only cancel when the event is a pull_request
16- cancel-in-progress : ${{ github.event_name == 'pull_request' }}
13+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-%s', github.sha) }}
14+ cancel-in-progress : true
1715
1816jobs :
1917 run-tests :
2018 # Skip if this is an external contribution. GitHub secrets will be empty, so the step would fail anyway.
2119 if : ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
2220 runs-on : ubuntu-latest
2321 steps :
24- - name : Print current ref and sha
25- run : |
26- echo "github.ref=${{ github.ref }}"
27- echo "github.sha=${{ github.sha }}"
28-
2922 - name : Trigger and wait for Internal Tests
3023 uses : actions/github-script@v7
3124 with :
3528 const targetRepo = 'SpacetimeDBPrivate';
3629 const workflowId = 'internal-tests.yml';
3730 const targetRef = 'master';
38- 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;
3933 const preDispatch = new Date().toISOString();
4034
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+
4140 // Dispatch the workflow in the target repository
4241 await github.rest.actions.createWorkflowDispatch({
4342 owner: targetOwner,
0 commit comments