Skip to content

Commit

Permalink
post phpcs results in PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
carlHandy committed Jul 27, 2024
1 parent c12f0a6 commit b5de9f4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,20 @@ jobs:
run: composer install

- name: Run PHP CodeSniffer
run: vendor/bin/phpcs -p --standard=phpcs.xml --runtime-set ignore_warnings_on_exit 1
run: |
vendor/bin/phpcs -p --standard=phpcs.xml --report=checkstyle --runtime-set ignore_warnings_on_exit 1 | cs2pr
- name: Post PHPCS results as PR comment
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs');
const phpcsOutput = fs.readFileSync('phpcs-results.txt', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## PHP CodeSniffer Results\n\n```\n' + phpcsOutput + '\n```'
});

0 comments on commit b5de9f4

Please sign in to comment.