Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporal PR #82

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ on:
- main

jobs:
docker-build:
build-check:
name: Docker Build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t chatterpay-front .

- name: Status Report
run: echo "success"
57 changes: 57 additions & 0 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Repository Dispatch
on:
repository_dispatch:
types: [my-check]
jobs:
myEvent:
runs-on: ubuntu-latest
steps:
####################################################
# Update the status to show that the queued message
# was received and is being processed
####################################################
- 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 }}

####################################################
# Actually, we'll just sleep to simulate some work
####################################################
- name: Processing
run: sleep 10

#####################################################
# Send a final message to complete the run and
# provide any final updates. Doing this one in JSON
# to make it more readable. This approach can also
# be used to get total control over the serialized
# data types (for example, integers).
#####################################################
- 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
58 changes: 58 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Create Check

# To trigger the check
on:
pull_request:
branches:
- develop
- 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 # 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: Repository Dispatch
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 'event_type=my-check' \
-f 'client_payload[checkRunId]=${{ steps.checkrun.outputs.checkId }}' \
-f 'client_payload[sha]=${{ github.sha }}' \
/repos/${{ github.repository }}/dispatches
Loading