-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.65 KB
/
linting-action.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
# Job name
name: Application linting
# When the to run the greeting
on: [pull_request]
# Jobs to run for the action (You can have multiple actions in one file)
jobs:
run-linters:
# Job display name
name: Linting Action
# Runs on a Linux based OS
runs-on: ubuntu-latest
# Steps involved for this particular task
steps:
# Checks out the repository and enables the use of commands made available in the project ie npm run
- name: Checkout Git repository
uses: actions/checkout@v3
# Configure yarn
- name: Setup Node.js version
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
# Cache the node_modules, only invalidate when the yarn lock file changes
# Original source: https://dev.to/mpocock1/how-to-cache-nodemodules-in-github-actions-with-yarn-24eh
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
# Installs all the project dependencies e.g. prettier, eslint etc via a custom project script
- name: Install yarn dependencies
run: 'yarn install'
# Run the linting action
- name: Run linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # Authorizes the github action via a Github token which is for this repo only (Generated automatically)
eslint: true # Enables eslint
prettier: true # Enables prettier to prettieifer the code when commiting and spots any violations
auto_fix: false # Auto fixes an prettier or eslint violations