-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (40 loc) · 1.34 KB
/
format.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
name: Format
on:
push:
branches-ignore:
# don't format files on push to master because pushing
# to master triggers version releases and we don't want
# to trigger a re-release just for formatting. We'll wait
# until the next PR to fix the formatting issues
- master
jobs:
main:
name: Format files
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v1
- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install NPM dependencies
run: npm ci
- name: Format files
run: npx prettier --write "**/*.*"
- name: Show git working tree
run: git status
- name: Commit formatted files on branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "Automated Formatter"
git add -A
# Do nothing if there are no changes
git diff-index --quiet HEAD || git commit -m "Automated format of files"
- name: Push data to repo
uses: ad-m/[email protected]
with:
branch: ${{ github.ref }}
# Need to use special repo-scoped token so that when
# the push happens, it triggers CI again
github_token: ${{ secrets.REPO_SCOPED_TOKEN }}