Skip to content

Commit 27d1787

Browse files
Update code-style.yml
1 parent 1307ee1 commit 27d1787

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

.github/workflows/code-style.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
1-
name: code-style
1+
name: Code Style
22

3-
on:
4-
push:
5-
pull_request:
3+
on: [ push, pull_request ]
64

75
permissions: write-all
86

97
jobs:
10-
check:
11-
if: ${{ ! (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
12-
8+
style:
139
runs-on: ubuntu-latest
1410

1511
steps:
1612
- name: Checkout code
1713
uses: actions/checkout@v3
1814

19-
- name: Checking PHP Syntax
20-
uses: TheDragonCode/codestyler@v3
21-
22-
fix:
23-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
24-
25-
runs-on: ubuntu-latest
15+
- name: Detect job name
16+
id: detect
17+
run: |
18+
[[ ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} ]] && NAME="Fix" || NAME="Check"
2619
27-
steps:
28-
- name: Checkout code
29-
uses: actions/checkout@v3
20+
echo "name=${NAME}" >> $GITHUB_OUTPUT
3021
31-
- name: Checking PHP Syntax
22+
- name: ${{ steps.detect.outputs.name }} the code style
3223
uses: TheDragonCode/codestyler@v3
3324
with:
3425
github_token: ${{ secrets.COMPOSER_TOKEN }}
35-
fix: true
26+
fix: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

0 commit comments

Comments
 (0)