-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f17c424
commit f226db9
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Repository Dispatch | ||
on: | ||
repository_dispatch: | ||
types: [my-check] | ||
jobs: | ||
myEvent: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Acknowledge Request | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh api -X PATCH -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-f 'status=in_progress' \ | ||
-f 'output[title]=My Check Run Title 🤔' \ | ||
-f 'output[summary]=A *fancy* summary' \ | ||
-f 'output[images][][image_url]=https://www.kenmuse.com/favicon/apple-touch-icon.png' \ | ||
-f 'output[images][][caption]=Sample from kenmuse.com' \ | ||
-f 'output[images][][alt]=Logo for kenmuse.com' \ | ||
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }} | ||
- name: Processing | ||
run: sleep 10 | ||
|
||
- name: Complete Check | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh api -X PATCH -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }} \ | ||
--input - <<- EOF | ||
{ | ||
"conclusion": "success", | ||
"details_url": "https://details.kenmuse.com", | ||
"output": { | ||
"title": "My Check Run Title 🚀", | ||
"summary": "**Summary**: The run completed.", | ||
"text": "Everything worked as expected. You should see a logo above." | ||
} | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Create 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 | ||
steps: | ||
- name: Create Check | ||
id: checkrun | ||
env: | ||
GH_TOKEN: ${{ github.token }} # Expose the token for GH CLI | ||
run: | | ||
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) | ||
echo "checkId=$CHECKID" >> $GITHUB_OUTPUT | ||
- name: Repository Dispatch | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh api -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-f 'event_type=my-check' \ | ||
-f 'client_payload[checkRunId]=${{ steps.checkrun.outputs.checkId }}' \ | ||
-f 'client_payload[sha]=${{ github.sha }}' \ | ||
/repos/${{ github.repository }}/dispatches |