Skip to content

Commit

Permalink
Merge pull request #358 from product-os/kyle/pr-checkout-ref
Browse files Browse the repository at this point in the history
Checkout the PR merge branch for pull_request_target events
  • Loading branch information
klutchell authored Dec 2, 2022
2 parents 77272ec + ce8588f commit a17203b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 6 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/flowzone.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 31 additions & 3 deletions flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,24 @@ jobs:
custom_always: ${{ steps.custom.outputs.always }}

steps:
- name: Checkout source
# for pull_request_target events that are not closed we need to specify the merge branch manually
# because the default checkout ref is the tip of the main/master branch
- name: Checkout merge branch
if: github.event_name == 'pull_request_target' && needs.event_types.outputs.pr_closed != true
id: checkout_merge
uses: actions/checkout@v3
with:
fetch-depth: ${{ inputs.checkout_fetch_depth }}
fetch-depth: 0
submodules: "recursive"
token: ${{ secrets.FLOWZONE_TOKEN }}
ref: "refs/pull/${{ github.event.number }}/merge"

# otherwise use the default checkout behaviour
- name: Checkout sha
if: steps.checkout_merge.outcome == 'skipped'
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
token: ${{ secrets.FLOWZONE_TOKEN }}

Expand Down Expand Up @@ -696,7 +710,21 @@ jobs:
version: ${{ steps.new_version.outputs.semver }}

steps:
- name: Checkout source
# for pull_request_target events that are not closed we need to specify the merge branch manually
# because the default checkout ref is the tip of the main/master branch
- name: Checkout merge branch
if: github.event_name == 'pull_request_target' && needs.event_types.outputs.pr_closed != true
id: checkout_merge
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
token: ${{ secrets.FLOWZONE_TOKEN }}
ref: "refs/pull/${{ github.event.number }}/merge"

# otherwise use the default checkout behaviour
- name: Checkout sha
if: steps.checkout_merge.outcome == 'skipped'
uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down

0 comments on commit a17203b

Please sign in to comment.