Skip to content

Commit e68b7e6

Browse files
committed
autofix ecs & rector
1 parent addf969 commit e68b7e6

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/code-style.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: code-style
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [ master ]
67
pull_request:
@@ -38,4 +39,39 @@ jobs:
3839
run: composer install --prefer-dist --no-progress
3940

4041
- name: Run ecs
41-
run: composer ecs
42+
run: composer ecs-fix
43+
44+
- name: "Check if build has changed"
45+
if: success()
46+
id: has-changes
47+
run: |
48+
echo "stdout<<EOF" >> $GITHUB_OUTPUT
49+
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
50+
echo 'EOF' >> $GITHUB_OUTPUT
51+
52+
- name: Import GPG key
53+
if: ${{ steps.has-changes.outputs.stdout }}
54+
uses: crazy-max/ghaction-import-gpg@v6
55+
with:
56+
gpg_private_key: ${{ secrets.GPG_BOT }}
57+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
58+
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
59+
git_config_global: true
60+
git_user_signingkey: true
61+
git_commit_gpgsign: true
62+
git_committer_name: Github bot
63+
git_committer_email: [email protected]
64+
65+
- name: "Commit files"
66+
if: ${{ steps.has-changes.outputs.stdout }}
67+
env:
68+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
69+
run: |
70+
gh pr checkout ${{ github.event.pull_request.number }}
71+
git commit -S -m "ecs fix" -a
72+
73+
- name: "Push changes"
74+
if: ${{ steps.has-changes.outputs.stdout }}
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
77+
run: git push -u origin HEAD

.github/workflows/rector.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: rector
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [ master ]
67
pull_request:
@@ -38,4 +39,39 @@ jobs:
3839
run: composer install --prefer-dist --no-progress
3940

4041
- name: Run rector
41-
run: composer rector
42+
run: composer rector-fix
43+
44+
- name: "Check if build has changed"
45+
if: success()
46+
id: has-changes
47+
run: |
48+
echo "stdout<<EOF" >> $GITHUB_OUTPUT
49+
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
50+
echo 'EOF' >> $GITHUB_OUTPUT
51+
52+
- name: Import GPG key
53+
if: ${{ steps.has-changes.outputs.stdout }}
54+
uses: crazy-max/ghaction-import-gpg@v6
55+
with:
56+
gpg_private_key: ${{ secrets.GPG_BOT }}
57+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
58+
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
59+
git_config_global: true
60+
git_user_signingkey: true
61+
git_commit_gpgsign: true
62+
git_committer_name: Github bot
63+
git_committer_email: [email protected]
64+
65+
- name: "Commit files"
66+
if: ${{ steps.has-changes.outputs.stdout }}
67+
env:
68+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
69+
run: |
70+
gh pr checkout ${{ github.event.pull_request.number }}
71+
git commit -S -m "rector fix" -a
72+
73+
- name: "Push changes"
74+
if: ${{ steps.has-changes.outputs.stdout }}
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
77+
run: git push -u origin HEAD

rector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
// Define what rule sets will be applied
1717
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
1818
$config->import(PHPUnitSetList::PHPUNIT_100);
19+
$config->import(SetList::STRICT_BOOLEANS);
20+
$config->import(SetList::PRIVATIZATION);
21+
$config->import(SetList::EARLY_RETURN);
22+
$config->import(SetList::INSTANCEOF);
1923
$config->import(SetList::CODE_QUALITY);
2024
$config->import(SetList::DEAD_CODE);
2125
$config->import(SetList::PHP_82);

0 commit comments

Comments
 (0)