From 8ce77e23bacf1d7a1cedb5b1ea24b928bb8d23d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Tue, 27 Jun 2023 11:18:13 +0200 Subject: [PATCH] feat(ci): support forked repos by checking out using target of pull request (#4193) --- .github/workflows/ci-cd-trigger.yml | 5 ++++- .github/workflows/cypress-run.yml | 1 + .github/workflows/lint-pr.yml | 2 ++ .github/workflows/publish-dist.yml | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index 2aa64ce2d..af4a5a30c 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -6,7 +6,7 @@ on: - release/* - develop - main - pull_request: + pull_request_target: types: - opened - ready_for_review @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Cache node modules id: cache @@ -60,6 +62,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup node uses: actions/setup-node@v3 diff --git a/.github/workflows/cypress-run.yml b/.github/workflows/cypress-run.yml index 31039e427..99d010924 100644 --- a/.github/workflows/cypress-run.yml +++ b/.github/workflows/cypress-run.yml @@ -33,6 +33,7 @@ jobs: with: fetch-depth: 0 path: './frontend-monorepo' + ref: ${{ github.event.pull_request.head.sha || github.sha }} # Restore node_modules from cache if possible - name: Restore node_modules from cache diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index c9133720c..9b1666a42 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -11,6 +11,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup node uses: actions/setup-node@v3 diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 343e8eddb..1533b5b47 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -19,6 +19,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Set up QEMU id: quemu