From e2c025591c572efdd04728fac301b2e025596516 Mon Sep 17 00:00:00 2001 From: neuronull Date: Tue, 30 May 2023 16:14:59 -0600 Subject: [PATCH] fix(ci): post failed status to PR and isolate branch checkout on comment trigger (#17544) --- .github/workflows/regression.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 629ae62c201db..2811a0042237c 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -129,6 +129,12 @@ jobs: - uses: actions/checkout@v3 + - name: Checkout PR branch (issue_comment) + if: github.event_name == 'issue_comment' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr checkout ${{ github.event.issue.number }} + # If triggered by issue comment, the event payload doesn't directly contain the head and base sha from the PR. # But, we can retrieve this info from some commands. - name: Get PR metadata (issue_comment) @@ -140,8 +146,6 @@ jobs: export PR_NUMBER=${{ github.event.issue.number }} echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT - gh pr checkout ${PR_NUMBER} - export BASELINE_SHA=$(git merge-base --fork-point master) echo "BASELINE_SHA=${BASELINE_SHA}" >> $GITHUB_OUTPUT @@ -768,7 +772,7 @@ jobs: if: github.event_name == 'issue_comment' && env.FAILED == 'true' uses: myrotvorets/set-commit-status-action@v1.1.7 with: - sha: ${{ steps.compute-metadata.outputs.comparison-sha }} + sha: ${{ steps.comment-branch.outputs.head_sha }} token: ${{ secrets.GITHUB_TOKEN }} context: Regression Detection Suite status: 'failure'