Skip to content

Commit

Permalink
Handle missing token on Rector CI workflow on forks (#3433)
Browse files Browse the repository at this point in the history
* Handle missing token on Rector CI workflow

* test add unused property to run rectify

* update templates workflow for require token

* [ci-review] Rector Rectify

---------

Co-authored-by: GitHub Action <actions@github.com>
  • Loading branch information
samsonasik and actions-user committed Mar 1, 2023
1 parent a2cd728 commit 4bd93ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/rector.yaml
Expand Up @@ -20,12 +20,20 @@ jobs:
timeout-minutes: 8

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:
Expand Down
10 changes: 9 additions & 1 deletion templates/rector-github-action-check.yaml
Expand Up @@ -10,12 +10,20 @@ jobs:
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:
# needed to trigger workflow after push
# 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:
Expand Down

0 comments on commit 4bd93ba

Please sign in to comment.