From 80e4ede746227cfa415af28177a32eef19bd6cbe Mon Sep 17 00:00:00 2001 From: Al N Date: Wed, 31 Jul 2024 14:59:42 +0300 Subject: [PATCH] clean lint workflow --- .github/workflows/php-style-lint.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php-style-lint.yml b/.github/workflows/php-style-lint.yml index a1167c3..f23d02c 100644 --- a/.github/workflows/php-style-lint.yml +++ b/.github/workflows/php-style-lint.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Setup PHP @@ -25,11 +25,19 @@ jobs: run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json - name: Install Composer dependencies run: composer install + - name: Get Pull Request Number + id: pr + run: echo "::set-output name=pull_request_number::$(gh pr view --json number -q .number || echo "")" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run PHPCS # Get the changed files from the PR via Github CLI. # `grep` to only PHP files then remove deleted files via `find`. # Run `phpcs` on the remaining files and pass output to `cs2pr`. run: | echo "Files for this PR:" - gh pr diff ${{ github.event.number }} --name-only | grep .php | xargs find 2> /dev/null | cat - gh pr diff ${{ github.event.number }} --name-only | grep .php | xargs find 2> /dev/null | xargs vendor/bin/phpcs -nq --report=checkstyle | cs2pr + gh pr diff $PR --name-only | grep .php | xargs find 2> /dev/null | cat + gh pr diff $PR --name-only | grep .php | xargs find 2> /dev/null | xargs vendor/bin/phpcs -nq --report=checkstyle | cs2pr + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ steps.pr.outputs.pull_request_number }}