-
Notifications
You must be signed in to change notification settings - Fork 34
44 lines (36 loc) · 1.22 KB
/
master-ci.yaml
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
name: Master CI
on:
push:
branches:
- master
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ github.head_ref }}
- name: Run prettier on src/web
working-directory: src/web
run: |
PRETTIER_VERSION=$(cat package.json | \
grep \"prettier\" | \
tr -d '[:space:]' | \
awk -F: '{print substr($2, 2, length($2) - 3)}')
if ! npx prettier@$PRETTIER_VERSION "**/*.(js|vue)" --check;
then
echo "Running prettier"
npx prettier@$PRETTIER_VERSION "**/*.(js|vue)" --write
echo "Setting up git"
git config --global user.name "I'm a Github Action"
git config --global user.email "beepboop@github.com"
git remote set-url origin https://x-access-token:${{ secrets.LINT_PAT }}@github.com/${{ github.repository }}
echo "Committing changes"
git commit -am "beep boop Github Action Master Branch CI Prettier hard at work"
git push
echo "Changes pushed"
exit 1
else
echo "Files are clean"
fi