Skip to content

Commit 97e374d

Browse files
Xuan Thinhtanhongit
authored andcommitted
feat: add some workflows to check and style codeformat
1 parent 48be0fc commit 97e374d

File tree

6 files changed

+126
-16
lines changed

6 files changed

+126
-16
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
php-cs-fixer:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.head_ref }}
17+
18+
- name: Run PHP CS Fixer
19+
uses: docker://oskarstark/php-cs-fixer-ga
20+
with:
21+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
22+
23+
- name: Commit changes
24+
uses: stefanzweifel/git-auto-commit-action@v5
25+
with:
26+
commit_message: Fix styling

.github/workflows/setup_test.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
name: Setup and test
1+
name: Setup & test
22

33
on: [ push, pull_request ]
44

55
jobs:
66
tests:
7-
name: Setup and run tests
8-
runs-on: ubuntu-latest
7+
name: Composer P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ ubuntu-latest ]
12+
php: [ '8.1', '8.2' ]
13+
laravel: [ 10.*, 9.* ]
14+
include:
15+
- laravel: 10.*
16+
testbench: 8.*
917
steps:
1018
- name: Setup PHP
1119
uses: shivammathur/setup-php@v2
1220
with:
13-
php-version: '8.2'
21+
php-version: ${{ matrix.php }}
22+
1423
- name: Checkout code
15-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
25+
1626
- name: Install dependencies
1727
run: |
1828
composer install --no-interaction --no-progress --no-suggest
29+
1930
- name: Run tests
2031
run: |
2132
composer validate --strict
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Update Changelog
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
ref: main
19+
20+
- name: Update Changelog
21+
uses: stefanzweifel/changelog-updater-action@v1
22+
with:
23+
latest-version: ${{ github.event.release.name }}
24+
release-notes: ${{ github.event.release.body }}
25+
26+
- name: Commit updated CHANGELOG
27+
uses: stefanzweifel/git-auto-commit-action@v5
28+
with:
29+
branch: main
30+
commit_message: Update CHANGELOG
31+
file_pattern: CHANGELOG.md

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ npm-debug.log
2828

2929
package-lock.json
3030
yarn.lock
31-
/.sass-cache
31+
/.sass-cache
32+
33+
build
34+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->ignoreDotFiles(true)
10+
->ignoreVCS(true);
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules([
14+
'@PSR12' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
17+
'no_unused_imports' => true,
18+
'trailing_comma_in_multiline' => true,
19+
'phpdoc_scalar' => true,
20+
'unary_operator_spaces' => true,
21+
'binary_operator_spaces' => true,
22+
'blank_line_before_statement' => [
23+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
24+
],
25+
'phpdoc_single_line_var_spacing' => true,
26+
'phpdoc_var_without_name' => true,
27+
'class_attributes_separation' => [
28+
'elements' => [
29+
'method' => 'one',
30+
],
31+
],
32+
'method_argument_space' => [
33+
'on_multiline' => 'ensure_fully_multiline',
34+
'keep_multiple_spaces_after_comma' => true,
35+
],
36+
'single_trait_insert_per_statement' => true,
37+
])
38+
->setFinder($finder);

composer.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "lbiltech/laravel-telegram-git-notifier",
2+
"name": "cslant/laravel-telegram-git-notifier",
33
"description": "Send notification from Gitlab and Github events to Telegram",
44
"keywords": [
5-
"lbiltech",
5+
"cslant",
66
"telegram-bot",
77
"notify",
88
"git-webhook",
@@ -15,7 +15,7 @@
1515
"telegram-bot-github-notify",
1616
"telegram-bot-gitlab-notify"
1717
],
18-
"homepage": "https://github.com/lbiltech/laravel-telegram-git-notifier",
18+
"homepage": "https://github.com/cslant/laravel-telegram-git-notifier",
1919
"license": "MIT",
2020
"authors": [
2121
{
@@ -32,29 +32,30 @@
3232
],
3333
"autoload": {
3434
"psr-4": {
35-
"LbilTech\\LaravelTelegramGitNotifier\\": "src/"
35+
"CSlant\\LaravelTelegramGitNotifier\\": "src/"
3636
}
3737
},
3838
"autoload-dev": {
3939
"psr-4": {
40-
"LbilTech\\LaravelTelegramGitNotifier\\Tests\\": "tests/"
40+
"CSlant\\LaravelTelegramGitNotifier\\Tests\\": "tests/"
4141
}
4242
},
4343
"require": {
4444
"php": "^8.0",
45-
"lbiltech/telegram-git-notifier": "dev-main"
45+
"CSlant/telegram-git-notifier": "dev-main"
4646
},
4747
"require-dev": {
48-
"phpunit/phpunit": "^9.5|^10.0",
49-
"mockery/mockery": "^1.6"
48+
"friendsofphp/php-cs-fixer": "^v3.37.1",
49+
"pestphp/pest": "^2.24",
50+
"phpstan/phpstan": "^1.10.39"
5051
},
5152
"support": {
52-
"issues": "https://github.com/lbiltech/laravel-telegram-git-notifier/issues"
53+
"issues": "https://github.com/cslant/laravel-telegram-git-notifier/issues"
5354
},
5455
"extra": {
5556
"laravel": {
5657
"providers": [
57-
"LbilTech\\LaravelTelegramGitNotifier\\Providers\\TelegramGitNotifierServiceProvider"
58+
"CSlant\\LaravelTelegramGitNotifier\\Providers\\TelegramGitNotifierServiceProvider"
5859
]
5960
}
6061
},

0 commit comments

Comments
 (0)