From fdaf37f8438803ec562675df768a27d9a2f4bb66 Mon Sep 17 00:00:00 2001 From: Jax DesMarais-Leder Date: Tue, 14 Nov 2023 15:56:08 -0600 Subject: [PATCH] update GitHub Action CI to work with forks --- .github/workflows/build.yml | 10 ++++++++-- .github/workflows/tests.yml | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16094c52b..48c2bf1ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ name: Build -on: [pull_request, workflow_dispatch] +on: [pull_request] concurrency: group: build-${{ github.event.number }} cancel-in-progress: true @@ -10,6 +10,9 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Use Xcode 14 run: sudo xcode-select -switch /Applications/Xcode_14.3.app - name: Run pod lib lint @@ -20,10 +23,13 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Use Xcode 14 run: sudo xcode-select -switch /Applications/Xcode_14.3.app - name: Use current branch - run: sed -i '' 's/branch = .*/branch = \"'"$GITHUB_HEAD_REF"'\";/' SampleApps/SPMTest/SPMTest.xcodeproj/project.pbxproj + run: sed -i '' 's/branch = .*/branch = \"'"${GITHUB_HEAD_REF//\//\/}"'\";/' SampleApps/SPMTest/SPMTest.xcodeproj/project.pbxproj - name: Run swift package resolve run: cd SampleApps/SPMTest && swift package resolve - name: Build & archive SPMTest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 04546a6e2..b0c4ea9ea 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ name: Tests -on: [pull_request, workflow_dispatch] +on: [pull_request] concurrency: group: tests-${{ github.event.number }} cancel-in-progress: true @@ -10,6 +10,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Use Xcode 14 run: sudo xcode-select -switch /Applications/Xcode_14.3.app - name: Run Unit Tests