-
Notifications
You must be signed in to change notification settings - Fork 37
55 lines (53 loc) · 1.68 KB
/
format-all.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
name: formatter-all
on:
push:
branches: [ main ]
pull_request:
types: [ labeled ]
jobs:
formatter:
name: formatter
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format_all') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Check exist lua files
id: check_lua_files
uses: andstor/file-existence-action@v2
with:
files: "*.lua"
- name: Install stylua and format files
if: steps.check_lua_files.outputs.files_exists == 'true'
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v0.18.0
args: -- .
- name: Check exist web files
id: check_web_files
uses: andstor/file-existence-action@v2
with:
files: "**/*.{ts,js,css,html}"
- name: Format files with Prettier
if: steps.check_web_files.outputs.files_exists == 'true'
run: |
npx prettier --write '**/*.{ts,js,css,html}'
- name: Update repo before push
run: |
git pull
- name: Commit changes and push current branch
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: ESX GITHUB ACTIONS BOT
commit_user_email: esx-github-actions-bot@users.noreply.github.com
commit_message: :art:Code formatted in all files