Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pputman12 committed May 29, 2024
1 parent 7a03cdc commit 6aca49f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/check-linter-error.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check lint failure

on:
pull_request:
types:
- opened
branches:
- $default-branch

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
comment_on_lint_failure:
name: Comment on lint failure
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
- name: Install
run: yarn --frozen-lockfile
- name: Build
run: yarn build
- name: lint
run: yarn lint
- name: Check dependency versions
run: node scripts/check-dependencies.js
- name: Install website
working-directory: docs/
run: yarn
- name: Lint website
working-directory: docs/
run: yarn lint
- name: Save PR number
if: ${{ failure() }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: pr
path: pr/
36 changes: 36 additions & 0 deletions .github/workflows/comment-on-linter-error.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Comment on the pull request

# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Check lint failure"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: pr
path: pr/

- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./pr/NR'));
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Thanks for submitting this PR!\n\nUnfortunately, it has some linter errors, so we can't merge it yet. Can you please fix them?\n\nRunning yarn `lint:fix` in the root of the repository may fix them automatically."
})

0 comments on commit 6aca49f

Please sign in to comment.