forked from learningequality/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (63 loc) · 2.28 KB
/
frontendlint.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
56
57
58
59
60
61
62
63
64
65
name: Javascript Linting
on:
push:
branches:
- unstable
- hotfixes
- master
pull_request:
jobs:
pre_job:
name: Path match check
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths: '["**.vue", "**.js", "yarn.lock", ".github/workflows/frontendlint.yml"]'
test:
name: Frontend linting
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
run: |
yarn --frozen-lockfile
npm rebuild node-sass
- name: Run tests
run: yarn run lint-frontend:format
- name: Check for modified files
if: github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository
id: git-check
run: echo ::set-output name=modified::$(git diff-index --name-only HEAD)
- uses: tibdex/github-app-token@v1
if: github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository && steps.git-check.outputs.modified != ''
id: generate-token
with:
app_id: ${{ secrets.CODE_FIX_APP_ID }}
private_key: ${{ secrets.CODE_FIX_APP_PRIVATE_KEY }}
- name: Push changes
if: github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository && steps.git-check.outputs.modified != ''
run: |
git config --global user.name 'Learning Equality'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }}
git commit -am "Frontend linting of ${{ steps.git-check.outputs.modified }}"
git push