forked from serverless-dns/serverless-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.12 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: PR
on:
pull_request:
branches:
- "main"
jobs:
lint-fmt:
name: Lint & fmt
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 50
- name: 🔧 Run eslint
run: |
npm install
git fetch --all
DIFF=$(git diff --name-only --diff-filter=ACMRT \
origin/${{ github.base_ref }}...origin/${{ github.head_ref }})
npx eslint $DIFF --cache --fix
- name: 👀 Looking for changes
id: lint-changes
run: |
echo ::set-output name=changes::$( \
if git diff-index --quiet HEAD --; \
then echo "false"; \
else echo "true"; \
fi)
- name: 🚢 Pushing to PR branch
if: steps.lint-changes.outputs.changes == 'true'
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git commit --no-verify -am "Automatic lint & fmt"
git push