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