From 4d4def62d15b5f645661a14fe3444f3acb76a03d Mon Sep 17 00:00:00 2001
From: Tomas Votruba <tomas.vot@gmail.com>
Date: Wed, 28 Oct 2020 21:47:23 +0100
Subject: [PATCH] [ci] add fix for missing secrets in 3rd party forks

---
 .github/workflows/rector_ci.yaml | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/rector_ci.yaml b/.github/workflows/rector_ci.yaml
index 3b2da9706ec..734e0262c48 100644
--- a/.github/workflows/rector_ci.yaml
+++ b/.github/workflows/rector_ci.yaml
@@ -28,11 +28,20 @@ jobs:
 
         runs-on: ubuntu-latest
         steps:
-            -   uses: actions/checkout@v2
+            # 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@v2
                 with:
                     # Must be used to trigger workflow after push
                     token: ${{ secrets.ACCESS_TOKEN }}
 
+            # in forks, the token is not available - so we cannot us eit
+            -
+                if: github.event.pull_request.head.repo.full_name != github.repository
+                uses: actions/checkout@v2
+
             -
                 uses: shivammathur/setup-php@v1
                 with: