From b8e59e1acd47b13c3b16e444a302564e6bd70e77 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 26 Oct 2022 13:01:57 -0400 Subject: [PATCH] ci(checkout): check out correct fork/branch during PR CI run --- .github/workflows/ci-jobs.yml | 22 ++++++++++++++++++++++ .github/workflows/pr-ci.yml | 3 +++ 2 files changed, 25 insertions(+) diff --git a/.github/workflows/ci-jobs.yml b/.github/workflows/ci-jobs.yml index 17538c3bda..ef4e9a149a 100644 --- a/.github/workflows/ci-jobs.yml +++ b/.github/workflows/ci-jobs.yml @@ -1,5 +1,12 @@ on: workflow_call: + inputs: + checkout-repo: + required: false + type: string + checkout-ref: + required: false + type: string outputs: image-version: description: the Cryostat application version that will be built @@ -10,6 +17,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} - id: query-pom name: Get properties from POM # Query POM for core and image version and save as output parameter @@ -52,6 +62,8 @@ jobs: steps: - uses: actions/checkout@v2 with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} submodules: true fetch-depth: 0 - uses: actions/setup-java@v2 @@ -84,6 +96,8 @@ jobs: steps: - uses: actions/checkout@v2 with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} submodules: true fetch-depth: 0 - uses: actions/setup-java@v2 @@ -111,6 +125,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} - name: Run spotless run: mvn spotless:check @@ -119,6 +136,8 @@ jobs: steps: - uses: actions/checkout@v2 with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} submodules: true fetch-depth: 0 - uses: skjolber/maven-cache-github-action@v1 @@ -135,5 +154,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} - name: Run shellcheck run: mvn shellcheck:check diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 540d5b4125..c14fc11edd 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -21,6 +21,9 @@ on: jobs: build-and-test: uses: ./.github/workflows/ci-jobs.yml + with: + checkout-repo: ${{ github.repository }} + checkout-ref: ${{ github.event.pull_request.head.ref }} if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test') push-to-ghcr: