-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ordering. Update to use PR merge ref (#1383)
- Loading branch information
1 parent
ce3ddb9
commit 561b482
Showing
1 changed file
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,40 +71,10 @@ jobs: | |
echo "Showing help on PR ${PR_NUMBER}" | ||
gh pr comment ${PR_NUMBER} --repo $REPO --body "Hello<br/><br/>You can use the following commands:<br/> /test - run tests on a PR<br/> /force-approve - force approval of the PR (i.e. skip the deployment checks)<br/> /help - show this help" | ||
# Check if the PR build/test needs to run | ||
- name: Checkout | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' || steps.check_command.outputs.result == 'force-approve' }} | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ inputs.prRepo }} | ||
ref: ${{ inputs.prRef }} | ||
persist-credentials: false | ||
|
||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' }} | ||
with: | ||
filters: | | ||
not-md: | ||
# we need to check for changes in files other than *.md | ||
- '**/!(*.md)' | ||
# If we don't run the actual deploy (below) we won't receive a check-run status, | ||
# and will have to send it "manually" | ||
- name: Bypass E2E check-runs status | ||
if: ${{ (steps.check_command.outputs.result == 'run-tests' && steps.filter.outputs.not-md == 'false') || steps.check_command.outputs.result == 'force-approve' }} | ||
uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# the name must be identical to the one received by the real job | ||
name: "Deploy PR / Run E2E Tests (Smoke)" | ||
status: "completed" | ||
conclusion: "success" | ||
|
||
# Get PR commit details for running tests | ||
- id: get_pr_details | ||
name: Get PR details | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' && steps.filter.outputs.not-md == 'true' }} | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' }} | ||
env: | ||
PR_NUMBER: ${{ github.event.issue.number }} | ||
REPO: ${{ github.event.repository.full_name }} | ||
|
@@ -120,10 +90,13 @@ jobs: | |
echo "Getting PR ref..." | ||
ref=$(gh pr view $PR_NUMBER --repo $REPO --json commits | jq -r ".[] | last | .oid") | ||
echo -e "\tLatest commit ref: $ref" | ||
# Get the prMergeCommit as this is what the pull_request trigger would build | ||
prMergeRef=$(gh pr view $PR_NUMBER --repo $REPO --json potentialMergeCommit | jq -r .potentialMergeCommit.oid) | ||
echo -e "\tprMergeRef: $prMergeRef" | ||
echo | ||
echo "Setting outputs" | ||
echo "::set-output name=prRef::${ref}" | ||
echo "::set-output name=prRef::${prMergeRef}" | ||
echo "::set-output name=prRepo::${pr_owner}/${pr_repo}" | ||
echo "Done" | ||
|
@@ -134,6 +107,39 @@ jobs: | |
echo "using id of: ${REFID} for GitHub Ref: ${github_pr_ref}" | ||
echo "::set-output name=refid::${REFID}" | ||
# Check if the PR build/test needs to run | ||
- name: Checkout | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' || steps.check_command.outputs.result == 'force-approve' }} | ||
uses: actions/checkout@v2 | ||
with: | ||
# repository: ${{ steps.get_pr_details.outputs.prRepo }} | ||
ref: ${{ steps.get_pr_details.outputs.prRef }} | ||
persist-credentials: false | ||
|
||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
if: ${{ steps.check_command.outputs.result == 'run-tests' }} | ||
with: | ||
base: main | ||
ref: ${{ steps.get_pr_details.outputs.prRef }} | ||
filters: | | ||
not-md: | ||
# we need to check for changes in files other than *.md | ||
- '**/!(*.md)' | ||
# If we don't run the actual deploy (below) we won't receive a check-run status, | ||
# and will have to send it "manually" | ||
- name: Bypass E2E check-runs status | ||
if: ${{ (steps.check_command.outputs.result == 'run-tests' && steps.filter.outputs.not-md == 'false') || steps.check_command.outputs.result == 'force-approve' }} | ||
uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# the name must be identical to the one received by the real job | ||
name: "Deploy PR / Run E2E Tests (Smoke)" | ||
status: "completed" | ||
conclusion: "success" | ||
|
||
run_test: | ||
# Run the tests with the re-usable workflow | ||
needs: [pr_comment] | ||
|
@@ -142,7 +148,7 @@ jobs: | |
uses: ./.github/workflows/deploy_tre_reusable.yml | ||
with: | ||
prRef: ${{ needs.pr_comment.outputs.prRef }} | ||
prRepo: ${{ needs.pr_comment.outputs.prRepo }} | ||
# prRepo: ${{ needs.pr_comment.outputs.prRepo }} | ||
ciGitRef: ${{ needs.pr_comment.outputs.ciGitRef }} | ||
secrets: | ||
AAD_TENANT_ID: ${{ secrets.AAD_TENANT_ID }} | ||
|