mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-28 09:36:40 +08:00
Add CI for ESLint and Prettier in PRs (#1661)
This commit is contained in:
parent
62040c8099
commit
4d783c033d
1 changed files with 46 additions and 0 deletions
46
.github/workflows/ci.yml
vendored
Normal file
46
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: Lint and auto-format PRs
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
lint_and_format:
|
||||
name: Lint and auto-format
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout previous commit and then pull, to fetch everything in between
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{github.event.pull_request.base.sha}}
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||
- run: |
|
||||
git pull origin ${{github.event.pull_request.head.ref}}
|
||||
git checkout ${{github.event.pull_request.head.ref}}
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2.3.0
|
||||
with:
|
||||
node-version: 14
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx gulp lint
|
||||
|
||||
- name: Run Prettier
|
||||
run: npx pretty-quick --branch ${{github.event.pull_request.base.sha}}
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
git config user.name "GitHub Actions Bot"
|
||||
git config user.email "<>"
|
||||
git add --update
|
||||
git commit -m "Auto-format with Prettier" || :
|
||||
git push origin HEAD:${{github.event.pull_request.head.ref}}
|
Loading…
Add table
Reference in a new issue