-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.38 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
53
54
55
name: "Lints the code with ESLint"
on:
schedule:
- cron: "0 8 * * 0"
workflow_dispatch:
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
timeout-minutes: 10
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
persist-credentials: false
fetch-depth: 0
- name: "Bump Node.js to v20"
uses: actions/setup-node@v4
with:
node-version: lts/iron
check-latest: true
- name: "Install dependencies"
run: |
npm ci || npm i
- name: "Build and lint the code"
run: npm run build && npm run lint-fix
- name: "Check for changes"
id: git-check
run: |
git diff --exit-code || echo "##[set-output name=changed;]true"
- name: "Commit changes (if any)"
if: steps.git-check.outputs.changed
run: |
d=`date '+%Y/%m/%dT%H:%M:%SZ'`
git config --local user.email ${{ secrets.GH_EMAIL }}
git config --local user.name ${{ secrets.GH_USERNAME }}
git add -A
git commit -m "chore: weekly lint (${d})"
- name: "Push (if changes)"
if: steps.git-check.outputs.changed
uses: "ad-m/[email protected]"
with:
force: false
directory: '.'
branch: ${{ github.ref }}
github_token: ${{ secrets.GH_TOKEN }}