-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 1.48 KB
/
lint-layout.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
# Lint branches
# This workflow affects all our javascript projects, so currently every project with a build step. The logic for this is:
#
# 1. lint the project
# 2. commit any changes
# 3. push the changes
#
# It relies on the `GITHUB_TOKEN` secret being available in this repo.
name: lint-layout
on:
push:
branches-ignore:
- master
paths:
- 'layout/**'
jobs:
lint-and-commit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install and Lint
run: |
cd layout
npm ci
npm run lint
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git diff-index --quiet HEAD || git commit -m "automated linting fix-ups" -a
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Ensure we have latest changes
run: |
git rebase origin/${{ steps.extract_branch.outputs.branch }}
git pull
git fetch
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}