Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c233422

Browse files
committedJul 19, 2024
test
1 parent 8f02572 commit c233422

File tree

3 files changed

+55
-76
lines changed

3 files changed

+55
-76
lines changed
 

‎.github/workflows/integration-pr.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Integration Tests Check
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
start-check:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
checks: write # Permission to create a Check Run
12+
actions: write # Permission to run another workflow
13+
steps:
14+
- name: Create Check
15+
id: checkrun
16+
env:
17+
GH_TOKEN: ${{ github.token }} # Expose the token for GH CLI
18+
run: |
19+
20+
CHECKID=$(gh api -X POST -H "Accept: application/vnd.github+json" \
21+
-H "X-GitHub-Api-Version: 2022-11-28" \
22+
-f name='Integration Tests' \
23+
-f head_sha='${{ github.event.pull_request.head.sha }}' \
24+
-f status='queued' \
25+
-f 'output[title]=Run Integration Tests' \
26+
-f 'output[summary]=Running Integration Tests for Java SDK' \
27+
--jq '.id' \
28+
/repos/${{ github.repository }}/check-runs)
29+
30+
# Put the ID into a step variable
31+
echo "checkId=$CHECKID" >> $GITHUB_OUTPUT
32+
33+
- name: Trigger Workflow
34+
env:
35+
GH_TOKEN: ${{ github.token }}
36+
run: |
37+
# By default, this will run the workflow in the main branch.
38+
# To test changes the ref to the current branch.
39+
gh api -X POST -H "Accept: application/vnd.github+json" \
40+
-H "X-GitHub-Api-Version: 2022-11-28" \
41+
-f 'inputs[checkRunId]=${{ steps.checkrun.outputs.checkId }}' \
42+
-f "ref=run-tests" \
43+
/repos/${{ github.repository }}/actions/workflows/integration-tests.yml/dispatches
+12-21
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
11
name: Integration Tests
22
on:
3-
repository_dispatch:
4-
types: [integration-check]
3+
workflow_dispatch:
4+
inputs:
5+
checkRunId:
6+
description: "ID for the Check Run in a PR"
7+
type: string
8+
59
jobs:
610
myEvent:
711
runs-on: ubuntu-latest
812
steps:
9-
####################################################
10-
# Update the status to show that the queued message
11-
# was received and is being processed
12-
####################################################
1313
- name: Acknowledge Request
1414
env:
1515
GH_TOKEN: ${{ github.token }}
1616
run: |
1717
gh api -X PATCH -H "Accept: application/vnd.github+json" \
1818
-H "X-GitHub-Api-Version: 2022-11-28" \
1919
-f 'status=in_progress' \
20-
-f 'output[title]=Integration Tests' \
21-
-f 'output[summary]=Running Integration Tests for Py SDK' \
22-
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }}
20+
-f 'output[title]=Run Integration Tests' \
21+
-f 'output[summary]=Running Integration Tests for Java SDK' \
22+
/repos/${{ github.repository }}/check-runs/${{ github.event.inputs.checkRunId }}
2323
2424
####################################################
2525
# Actually, we'll just sleep to simulate some work
2626
####################################################
2727
- name: Processing
2828
run: sleep 10
2929

30-
#####################################################
31-
# Send a final message to complete the run and
32-
# provide any final updates. Doing this one in JSON
33-
# to make it more readable. This approach can also
34-
# be used to get total control over the serialized
35-
# data types (for example, integers).
36-
#####################################################
3730
- name: Complete Check
3831
env:
3932
GH_TOKEN: ${{ github.token }}
4033
run: |
4134
gh api -X PATCH -H "Accept: application/vnd.github+json" \
4235
-H "X-GitHub-Api-Version: 2022-11-28" \
43-
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }} \
36+
/repos/${{ github.repository }}/check-runs/${{ github.event.inputs.checkRunId }} \
4437
--input - <<- EOF
4538
{
4639
"conclusion": "success",
47-
"details_url": "TODO",
4840
"output": {
49-
"title": "Integration Tests",
50-
"summary": "**Summary**: The run completed.",
51-
"text": "Everything worked as expected."
41+
"title": "Run Integration Tests",
42+
"summary": "Successful execution of Integration Tests for Java SDK"
5243
}
5344
}
5445
EOF

‎.github/workflows/test-check.yml

-55
This file was deleted.

0 commit comments

Comments
 (0)