rector/templates/rector-github-action-check.yaml

45 lines
1.6 KiB
YAML
Raw Normal View History

# github action that checks code with Rector
name: Rector
on:
pull_request: null
jobs:
rector:
# Don't run on forks.
if: github.repository == '__CURRENT_REPOSITORY__'
runs-on: ubuntu-latest
steps:
# workaround for missing secret in fork PRs - see https://github.com/actions/checkout/issues/298
# see https://github.com/rectorphp/rector/commit/d395e1c28b8e6a56711dcc2e10490a82965850e4
-
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/checkout@v3
with:
# Must be used to trigger workflow after push
token: ${{ secrets.ACCESS_TOKEN }}
# in forks, the token is not available - so we cannot use it
-
if: github.event.pull_request.head.repo.full_name != github.repository
uses: actions/checkout@v3
-
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- uses: "ramsey/composer-install@v2"
- run: vendor/bin/rector --ansi
-
# commit only to core contributors who have repository access
if: github.event.pull_request.head.repo.full_name == github.repository
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[rector] Rector fixes'
commit_author: 'GitHub Action <actions@github.com>'
commit_user_email: 'action@github.com'