forked from yakamara/redaxo_yrewrite
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add chatops phpstan-baseline command (yakamara#374)
- Loading branch information
Showing
2 changed files
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Chatops | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
slash-command-dispatch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Slash Command Dispatch | ||
uses: peter-evans/slash-command-dispatch@v2 | ||
with: | ||
token: ${{ secrets.STAABM_TOKEN }} | ||
# reactions should be reported from github itself | ||
reaction-token: ${{ secrets.GITHUB_TOKEN }} | ||
commands: phpstan-baseline | ||
issue-type: pull-request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,54 @@ | ||
name: PHP Checks | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
repository_dispatch: | ||
types: [phpstan-baseline-command] # triggered by /phpstan-baseline PR comment | ||
|
||
jobs: | ||
|
||
phpstan-analysis: | ||
name: phpstan static code analysis | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
extensions: intl, imagick | ||
coverage: none # disable xdebug, pcov | ||
tools: cs2pr | ||
|
||
- name: Install Dependencies | ||
run: composer install --prefer-dist | ||
|
||
- run: | | ||
vendor/bin/phpstan analyse --no-progress | ||
phpstan-analysis: | ||
name: phpstan static code analysis | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Add action run link to trigger comment | ||
if: "github.event_name == 'repository_dispatch'" | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
token: ${{ secrets.STAABM_TOKEN }} | ||
repository: ${{ github.event.client_payload.github.payload.repository.full_name }} | ||
comment-id: ${{ github.event.client_payload.github.payload.comment.id }} | ||
body: | | ||
``` | ||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
``` | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.STAABM_TOKEN }} | ||
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | ||
ref: ${{ github.event.client_payload.pull_request.head.ref }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
extensions: intl, imagick | ||
coverage: none # disable xdebug, pcov | ||
|
||
- name: Install Dependencies | ||
run: composer install --ansi --prefer-dist | ||
|
||
- run: composer phpstan-baseline # generate baseline | ||
if: "github.event_name == 'repository_dispatch'" | ||
- name: Commit changed files | ||
if: "github.event_name == 'repository_dispatch'" | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Apply phpstan-baseline changes | ||
branch: ${{ github.head_ref }} | ||
file_pattern: '*.neon' | ||
|
||
- run: vendor/bin/phpstan analyse --ansi --no-progress | ||
if: "github.event_name != 'repository_dispatch'" |