Skip to content

Commit

Permalink
Test workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bitonality committed May 29, 2024
1 parent f17c424 commit f226db9
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/dispatch.yml
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
39 changes: 39 additions & 0 deletions .github/workflows/pull_request.yml
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

0 comments on commit f226db9

Please sign in to comment.