-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (44 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
51
52
53
54
55
56
57
name: format
# depends of tests.yml
on:
workflow_run:
workflows: [tests]
types: [completed]
jobs:
format-code:
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Email
run: git config --local user.email ${{ github.event.pusher.email }}
- name: Configure Name
run: git config --local user.name ${{ github.event.pusher.name }}
- name: Git Status
run: git status
- name: Format Code Style
run: npm run format
- name: Stage Changes
continue-on-error: true
run: git add .
- name: Save Changes
continue-on-error: true
run: git commit -m "[Auto-format code on push]" -m "Formatted the last commit -> '${{ github.event.head_commit.message }}'"
- name: Push Changes
continue-on-error: true
run: git push --force
- name: Done
run: echo done formatting files.
format-requirements-failed:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: rquirements failed
run: echo the tests failed
- name: force fail workflow
run: exit 1