Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr workflow - use merge SHA when available #17

Merged
merged 1 commit into from
Jan 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/_shared-docs-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ jobs:

core.setOutput('skip-init', skipInit)

// when a PR is first opened, the merge sha is blank
// when a PR is closed, the merge branch doesn't exist
// so let's set a var for the PR ref we'll checkout,
// using the merge SHA usually, but using the merge branch
// if the SHA is blank.

const mergeSha = '${{ github.event.pull_request.merge_commit_sha }}'
if (mergeSha != '') {
core.setOutput('pr-checkout-ref', mergeSha)
} else {
core.setOutput('pr-checkout-ref', 'refs/pull/${{ github.event.number }}/merge')
}

- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -199,7 +212,7 @@ jobs:
#
# since that also works when re-running this action for older commits of
# a PR, **but** then we get https://github.com/ansible-community/github-docs-build/issues/3 back...
ref: refs/pull/${{ github.event.number }}/merge
ref: ${{ steps.vars.outputs.pr-checkout-ref }}
path: ${{ steps.vars.outputs.checkout-path }}

- name: Initialize the build environment (HEAD)
Expand Down