mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-04 02:10:51 +00:00
da8b1801b0
4bd93ba93d
Handle missing token on Rector CI workflow on forks (#3433)
45 lines
1.6 KiB
YAML
45 lines
1.6 KiB
YAML
# 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'
|