Skip to content

Commit

Permalink
chore: make diff jobs work with pull_request_target (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan authored Jan 11, 2024
1 parent af3609a commit 766c224
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/diff-cdktf-stacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 766c224

Please sign in to comment.