1
+ name : Integration Tests Validation
2
+
3
+ # To trigger the check
4
+ on :
5
+ pull_request :
6
+ branches : [ "main" ]
7
+
8
+ jobs :
9
+ start-check :
10
+ runs-on : ubuntu-latest
11
+ permissions :
12
+ checks : write # Permission to create a Check Run
13
+ contents : write # Permission to write a repository_dispatch requests
14
+ steps :
15
+ - name : Integration Tests Check
16
+ id : testcheck # An ID to allow the step to be referenced
17
+ env :
18
+ GH_TOKEN : ${{ github.token }} # Expose the token for GH CLI
19
+ run : |
20
+ ##########################################################
21
+ # Create a Check Run and indicate that it is being queued
22
+ # Use --jq to return the ID
23
+ ##########################################################
24
+
25
+ CHECKID=$(gh api -X POST -H "Accept: application/vnd.github+json" \
26
+ -H "X-GitHub-Api-Version: 2022-11-28" \
27
+ -f name='Integration Tests Check' \
28
+ -f head_sha='${{ github.event.pull_request.head.sha }}' \
29
+ -f status='queued' \
30
+ -f 'output[title]=Integration Tests' \
31
+ -f 'output[summary]=Pending Integration Tests for Py SDK' \
32
+ --jq '.id' \
33
+ /repos/${{ github.repository }}/check-runs)
34
+
35
+ ####################################################
36
+ # Put the ID into a step variable
37
+ ####################################################
38
+
39
+ echo "checkId=$CHECKID" >> $GITHUB_OUTPUT
40
+
41
+ - name : Trigger Integration Tests
42
+ env :
43
+ GH_TOKEN : ${{ github.token }}
44
+ run : |
45
+ ##########################################################
46
+ # Create a repository_dispatch event of type my-check
47
+ # Send the SHA and the Check Run ID in the client_payload
48
+ ##########################################################
49
+
50
+ gh api -X POST -H "Accept: application/vnd.github+json" \
51
+ -H "X-GitHub-Api-Version: 2022-11-28" \
52
+ -f 'event_type=integration-check' \
53
+ -f 'client_payload[checkRunId]=${{ steps.checkrun.outputs.checkId }}' \
54
+ -f 'client_payload[sha]=${{ github.sha }}' \
55
+ /repos/${{ github.repository }}/dispatches
0 commit comments