-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
}) |