Skip to content

Commit

Permalink
try to fix invalid json
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Oct 4, 2023
1 parent d8b90e8 commit 74d6593
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 12 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/check_run_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a GitHub workflow YAML file
# see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
#
# If you want to update this file it's recommended to use a YAML validator
# https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
# configured to validate with https://json.schemastore.org/github-workflow.json
#
# This workflow is responsible to perform various checks related to the codebase,
# For every push to main or on a pull request, it
# - ensures there is no eslint error on files
# - ensures there is no test failing
# - uploads code coverage from tests to codecov
#
# If all these steps are passing and there is a secrets.NPM_TOKEN and version in package.json
# is not already published, workflow published the package on npm.

name: main

on:
push:
branches:
- main
pull_request:
branches:
- "**"

jobs:
test:
strategy:
matrix:
os: [ubuntu-20.04]
node: [20.8.0]
runs-on: ${{ matrix.os }}
name: test on ${{ matrix.os }} and node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install node modules
run: npm install
- name: Run ESLint
run: npm run eslint
- name: Run tests
run: node ./.github/workflows/run_check.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/run_check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {
readGitHubWorkflowEnv,
startGithubCheckRun,
} from "@jsenv/github-check-run";

const { progress, pass } = await startGithubCheckRun({
...readGitHubWorkflowEnv(),
checkName: "MY_CHECK_NAME",
checkTitle: "MY_CHECK_TITLE",
checkSummary: "MY_CHECK_SUMMARY",
});

await new Promise((resolve) => {
setTimeout(resolve, 2_000);
});
await progress({
title: "PROGRESS AFTER 2s",
summary: "SUMMARY AFTER 2s",
});

await new Promise((resolve) => {
setTimeout(resolve, 4_000);
});
await progress({
title: "PROGRESS AFTER 6s",
summary: "SUMMARY AFTER 6s",
});

await new Promise((resolve) => {
setTimeout(resolve, 6_000);
});
await pass({
title: "SUCCESS AFTER 10s",
summary: "SUMMARY AFTER 10s",
});
28 changes: 19 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@jsenv/eslint-import-resolver": "8.0.4",
"@jsenv/log": "3.4.0",
"@jsenv/package-workspace": "./packages/packages-workspace",
"@jsenv/github-check-run": "./packages/github-check-run",
"@jsenv/test": "1.6.8",
"eslint": "8.50.0",
"eslint-plugin-html": "7.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/github-check-run/src/internal/github_rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const GET = ({ url, githubToken, headers }) => {
method: "GET",
headers: {
...tokenToHeaders(githubToken),
headers,
...headers,
},
responseStatusHandlers: {
200: async (response) => {
Expand All @@ -24,7 +24,7 @@ export const POST = ({ url, body, githubToken, headers }) => {
method: "POST",
headers: {
...tokenToHeaders(githubToken),
headers,
...headers,
},
body: JSON.stringify(body),
responseStatusHandlers: {
Expand All @@ -43,7 +43,7 @@ export const PATCH = ({ signal, url, body, githubToken, headers }) => {
method: "PATCH",
headers: {
...tokenToHeaders(githubToken),
headers,
...headers,
},
body: JSON.stringify(body),
responseStatusHandlers: {
Expand Down

0 comments on commit 74d6593

Please sign in to comment.