From 8d91a38901c17b1b3614b0d23e09867716341c46 Mon Sep 17 00:00:00 2001 From: Nara Kasbergen Date: Thu, 11 Jan 2024 15:45:55 +0100 Subject: [PATCH] chore: make diff jobs work with pull_request_target --- .github/workflows/diff-cdktf-stacks.yml | 11 +++++++++++ .github/workflows/diff.yml | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/diff-cdktf-stacks.yml b/.github/workflows/diff-cdktf-stacks.yml index 2b1f1dd..c7da054 100644 --- a/.github/workflows/diff-cdktf-stacks.yml +++ b/.github/workflows/diff-cdktf-stacks.yml @@ -7,6 +7,14 @@ on: required: true description: JSON-stringified list of stacks to deploy, e.g. # [{ "stack": "my-stack" }] type: string + ref: + required: true + description: The SHA ref of the commit to check out + type: string + repository: + required: true + description: The fully qualified name of the repository to check out the commit from + type: string jobs: terraform: @@ -20,6 +28,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ inputs.ref }} + repository: ${{ inputs.repository }} - name: Setup Terraform uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 diff --git a/.github/workflows/diff.yml b/.github/workflows/diff.yml index 26140c9..fd3b528 100644 --- a/.github/workflows/diff.yml +++ b/.github/workflows/diff.yml @@ -21,10 +21,14 @@ jobs: needs: build-shard-matrix with: stacks: ${{ needs.build-shard-matrix.outputs.matrix }} + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} secrets: inherit diff_constructs: uses: ./.github/workflows/diff-cdktf-stacks.yml with: stacks: '{"stack":["custom-constructs"]}' + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} secrets: inherit