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

Test #4

Merged
merged 8 commits into from
Nov 1, 2023
Merged
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
21 changes: 21 additions & 0 deletions .github/workflows/ccc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Run Triggered Workflow

on:
check_run:
types: [created, completed]

jobs:
check-run-job:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run when check run is created
if: github.event.action == 'created'
run: echo "A check run was created."

- name: Run when check run is completed
if: github.event.action == 'completed'
run: echo "A check run was completed."
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 120

#####################################################
# 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
56 changes: 56 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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 # 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@ on:
push:
branches:
- main
- '!feature/*' # ignoring pushing to any feature branch using !
- test # ignoring pushing to any feature branch using !
pull_request:
types: opened


env:
DOCKERHUB_USERNAME: siddharth67
IMAGE_VERSION: ${{ github.sha }}

jobs:
code-coverage:
container:
image: node:19
runs-on: ubuntu-latest
services:
mongo-db:
image: siddharth67/mongo-db:non-prod
ports:
- 27017:27017
options:
--name mongo
steps:
- name: Checkout
uses: actions/checkout@v3

# - name: Setup NodeJS Version - 19
# uses: actions/setup-node@v3
# with:
# node-version: 19
- name: Setup NodeJS Version - 19
uses: actions/setup-node@v3
with:
node-version: 19

- name: Cache NPM dependencies
uses: actions/cache@v3
Expand All @@ -42,14 +36,12 @@ jobs:
run: npm install

- name: NPM Code Coverage
run: NODE_ENV=codeCoverage npm run coverage
run: NODE_ENV=deploy npm run coverage
continue-on-error: true


- name: Archive Code Coverage Result
uses: actions/upload-artifact@v3
with:
name: Code-Coverage-Result
path: coverage/
- name: list
run: ls -ltr

- name: Code Coverage Annotation
uses: ggilder/codecoverage@v1
Expand Down