-
Notifications
You must be signed in to change notification settings - Fork 3
32 lines (30 loc) · 1.02 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
name: Run Prettier
on: [push]
jobs:
format:
runs-on: ubuntu-20.04
steps:
- name: Pull Repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Prettier
run: |
sudo npm i -g prettier
- name: Format
run: |
if [ ! -f .prettierrc ]; then
echo ".prettierrc not found"
echo "terminating workflow..."
exit 1;
fi
prettier --check . --write
- name: Push Back Formatted Code
run: |
# configure git
git config --global user.name "Cosnavel"
git config --global user.email "niclasdevelop@gmail.com"
git add .
git commit -m "(CI) format code" || echo "nothing to commit"
git push