From af36d9c48dd15f61747bf14766660b78352649fd Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 18:03:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?up.=20PHPCS=20=E6=94=B9=E4=B8=BA=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index f2f1b6b6f..d52776b88 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -22,6 +22,20 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} run: | - echo "Running PHPCS on the following files:" + # echo "Running PHPCS on the following files:" + # echo "${ALL_CHANGED_FILES}" + # ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" --report=checkstyle + echo "Running PHPCBF on the following files:" echo "${ALL_CHANGED_FILES}" - ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" --report=checkstyle + ./vendor/bin/phpcbf "${ALL_CHANGED_FILES}" + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git status + git diff-index --quiet HEAD || (git commit -m "Auto Commit - phpcbf" -a --no-verify) + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} From 757086242f0a7b019c5ce310611a57ca669b44eb Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 19:20:51 +0800 Subject: [PATCH 2/6] =?UTF-8?q?style.=20yml=20=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 64 ++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index d52776b88..63aaf09cc 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -1,41 +1,41 @@ name: Run PHPCS on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: phpcs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-interaction - - name: Get file changes - id: get_file_changes - uses: tj-actions/changed-files@v44 - - name: PHPCS check - if: steps.get_file_changes.outputs.any_changed == 'true' - env: - ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} - run: | - # echo "Running PHPCS on the following files:" - # echo "${ALL_CHANGED_FILES}" - # ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" --report=checkstyle - echo "Running PHPCBF on the following files:" - echo "${ALL_CHANGED_FILES}" - ./vendor/bin/phpcbf "${ALL_CHANGED_FILES}" - - name: Commit files - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git status - git diff-index --quiet HEAD || (git commit -m "Auto Commit - phpcbf" -a --no-verify) - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-interaction + - name: Get file changes + id: get_file_changes + uses: tj-actions/changed-files@v44 + - name: PHPCS check + if: steps.get_file_changes.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} + run: | + # echo "Running PHPCS on the following files:" + # echo "${ALL_CHANGED_FILES}" + # ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" --report=checkstyle + echo "Running PHPCBF on the following files:" + echo "${ALL_CHANGED_FILES}" + ./vendor/bin/phpcbf "${ALL_CHANGED_FILES}" + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git status + git diff-index --quiet HEAD || (git commit -m "Auto Commit - phpcbf" -a --no-verify) + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} From a4c64a423561922e124c2e8594e4c19de1987ca9 Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 19:23:12 +0800 Subject: [PATCH 3/6] =?UTF-8?q?up.=20=E6=A0=B9=E6=8D=AE=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=86=B3=E5=AE=9A=E6=98=AF=E5=90=A6=E8=87=AA=E5=8A=A8=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 63aaf09cc..956d4a53a 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -22,12 +22,18 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} run: | - # echo "Running PHPCS on the following files:" - # echo "${ALL_CHANGED_FILES}" - # ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" --report=checkstyle + echo "Running PHPCS on the following files:" + echo "${ALL_CHANGED_FILES}" + ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" + - name: PHPCBF + if: steps.get_file_changes.outputs.any_changed == 'true' && github.event_name == 'push' + env: + ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} + run: | echo "Running PHPCBF on the following files:" echo "${ALL_CHANGED_FILES}" ./vendor/bin/phpcbf "${ALL_CHANGED_FILES}" + continue-on-error: true - name: Commit files run: | git config --local user.email "action@github.com" From d2c410780b5da1c1581743071d25a8cd0bd5a4a6 Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 19:28:15 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix.=20=E4=BB=85=E5=9C=A8=20push=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E4=B8=AD=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 956d4a53a..411cd9200 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -41,6 +41,7 @@ jobs: git status git diff-index --quiet HEAD || (git commit -m "Auto Commit - phpcbf" -a --no-verify) - name: Push changes + if: github.event_name == 'push' uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} From 281a90c0024721d7d3ce600e9f0898e4e41a30ac Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 19:57:22 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix.=20=E9=94=99=E8=AF=AF=E7=9A=84=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=BC=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 411cd9200..0cfc4a70f 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -24,7 +24,7 @@ jobs: run: | echo "Running PHPCS on the following files:" echo "${ALL_CHANGED_FILES}" - ./vendor/bin/phpcs "${ALL_CHANGED_FILES}" + ./vendor/bin/phpcs ${ALL_CHANGED_FILES} - name: PHPCBF if: steps.get_file_changes.outputs.any_changed == 'true' && github.event_name == 'push' env: @@ -32,7 +32,7 @@ jobs: run: | echo "Running PHPCBF on the following files:" echo "${ALL_CHANGED_FILES}" - ./vendor/bin/phpcbf "${ALL_CHANGED_FILES}" + ./vendor/bin/phpcbf ${ALL_CHANGED_FILES} continue-on-error: true - name: Commit files run: | From 66b56832995e54ea162e505608464aa2d187757b Mon Sep 17 00:00:00 2001 From: wdssmq Date: Tue, 30 Apr 2024 20:04:56 +0800 Subject: [PATCH 6/6] =?UTF-8?q?up.=20=E8=B0=83=E6=95=B4=20phpcs=20?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpcs.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 0cfc4a70f..c1245e326 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -17,14 +17,6 @@ jobs: - name: Get file changes id: get_file_changes uses: tj-actions/changed-files@v44 - - name: PHPCS check - if: steps.get_file_changes.outputs.any_changed == 'true' - env: - ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} - run: | - echo "Running PHPCS on the following files:" - echo "${ALL_CHANGED_FILES}" - ./vendor/bin/phpcs ${ALL_CHANGED_FILES} - name: PHPCBF if: steps.get_file_changes.outputs.any_changed == 'true' && github.event_name == 'push' env: @@ -35,6 +27,7 @@ jobs: ./vendor/bin/phpcbf ${ALL_CHANGED_FILES} continue-on-error: true - name: Commit files + if: github.event_name == 'push' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" @@ -46,3 +39,11 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} + - name: PHPCS check + if: steps.get_file_changes.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }} + run: | + echo "Running PHPCS on the following files:" + echo "${ALL_CHANGED_FILES}" + ./vendor/bin/phpcs ${ALL_CHANGED_FILES}