-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.62 KB
/
lint.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
43
44
45
46
47
48
49
50
51
52
name: ESlint
on:
push:
branches-ignore:
- 'main'
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_PAT }}
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup and cache pnpm
uses: ./.github/actions/pnpm-setup
- name: Install workspaces
env:
VERDACCIO_AUTH_TOKEN: ${{ secrets.VERDACCIO_AUTH_TOKEN }}
run: pnpm install
- name: Run ESlint
run: cd frontend && pnpm lint --fix
- name: Detect diff
id: detect-diff
run: |
if [ ! -z "$(git status --short)" ]; then
echo "HAS_DIFF=true" >> $GITHUB_OUTPUT
else
echo "HAS_DIFF=false" >> $GITHUB_OUTPUT
fi
- name: Fail if Dependabot
if: steps.detect-diff.outputs.HAS_DIFF == 'true' && github.actor == 'dependabot[bot]'
run: exit 1
- name: Commit changes
if: steps.detect-diff.outputs.HAS_DIFF == 'true'
run: |
git fetch --depth=1 origin "$GITHUB_REF_NAME"
git stash
git checkout "$GITHUB_REF_NAME"
git stash pop
git config user.name "github-actions[bot]"
git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>"
git add .
git commit -m "style: apply linter formatting diff"
git push