Skip to content

Commit 94dc96b

Browse files
authored
Merge pull request #27 from matriphe/install-superlinter
Fix Linter and GHA Overall
2 parents 73c788e + e765f8d commit 94dc96b

5 files changed

Lines changed: 65 additions & 113 deletions

File tree

.github/workflows/lint.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
name: Code Linting
22

33
on:
4-
push:
5-
branches-ignore:
6-
- master
7-
- main
84
pull_request:
9-
branches: [ main, master, develop ]
5+
branches:
6+
- master
107

118
jobs:
129
lint:
13-
name: PHP Code Style Check
10+
name: Lint
1411
runs-on: ubuntu-latest
15-
12+
13+
permissions:
14+
contents: read
15+
packages: read
16+
# To report GitHub Actions status checks
17+
statuses: write
18+
1619
steps:
1720
- name: Checkout code
18-
uses: actions/checkout@v4
19-
21+
uses: actions/checkout@v5
22+
with:
23+
# super-linter needs the full git history to get the
24+
# list of files that changed across commits
25+
fetch-depth: 0
26+
persist-credentials: false
27+
2028
- name: Setup PHP
2129
uses: shivammathur/setup-php@v2
2230
with:
23-
php-version: '8.4'
31+
php-version: 8.4
2432
extensions: mbstring
25-
coverage: none
33+
tools: composer:v2
2634

2735
- name: Cache Composer packages
2836
id: composer-cache
@@ -34,11 +42,17 @@ jobs:
3442
${{ runner.os }}-php-8.4
3543
3644
- name: Install dependencies
37-
run: composer install --prefer-dist --no-progress --no-interaction
38-
39-
- name: Run PHP CS Fixer (check only)
40-
run: vendor/bin/php-cs-fixer fix --dry-run --diff --show-progress=dots
41-
42-
- name: Lint Status
43-
if: success()
44-
run: echo "✅ Code style check passed! All files follow the coding standards."
45+
run: composer install --prefer-dist --no-progress
46+
47+
- name: Run PHP-CS-Fixer
48+
run: composer run-script lint
49+
50+
- name: Check for changes
51+
run: |
52+
if [ -n "$(git status --porcelain)" ]; then
53+
echo "Code style issues found. Please run 'composer run-script fix' locally."
54+
git diff
55+
exit 1
56+
else
57+
echo "No code style issues found."
58+
fi

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ name: Create Release
22

33
on:
44
workflow_run:
5-
workflows: ["Run Test"]
6-
types: [completed]
7-
branches: [master]
5+
workflows:
6+
- Run Test
7+
types:
8+
- completed
9+
branches:
10+
- master
811
workflow_dispatch:
912

1013
permissions:
@@ -19,7 +22,7 @@ jobs:
1922

2023
steps:
2124
- name: Checkout code
22-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2326
with:
2427
fetch-depth: 0
2528
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: Run Test
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches:
6+
- master
67
pull_request:
7-
branches: [ "master" ]
8+
branches:
9+
- master
810

911
permissions:
1012
contents: read
@@ -26,7 +28,7 @@ jobs:
2628

2729
steps:
2830
- name: Checkout code
29-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3032

3133
- name: Setup PHP
3234
uses: shivammathur/setup-php@v2

.php_cs

Lines changed: 0 additions & 85 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@ echo $iso->getLanguageByIsoCode2b('ind'); // ['id', 'ind', 'ind', 'ind', 'Indone
8383
echo $iso->getLanguageByIsoCode2b('jav'); // ['jv', 'jav', 'jav', 'jav', 'Javanese', 'basa Jawa']
8484
```
8585

86-
## To Do
86+
## Contributing
8787

88-
* Convert language name to ISO-639 code
88+
Do as usual contribution on open source projects by creating a pull request!
89+
90+
### Install Composer
91+
92+
```console
93+
composer install
94+
```
95+
96+
### Run Test
97+
98+
```console
99+
composer run-script test
100+
```
101+
102+
### Run Linter Fix
103+
104+
```console
105+
composer run-script lint:fix
106+
```

0 commit comments

Comments
 (0)