Skip to content

Commit

Permalink
CI: Github actions fix commit status on new PR
Browse files Browse the repository at this point in the history
On windows tester actions we are adding the status to the latest commit on a PR; to get the commit
value we inspect the gh context but the condition to get the value on a new PR (.event.after is null) is not catch by the expression and so the .sha value is not picked; as so the status is not correctly added to the commit. This fix extends the condition to check for null values; and if that is the case pick the right commit value

Signed-off-by: Adrian Riobo Lorenzo <ariobolo@redhat.com>
  • Loading branch information
adrianriobo authored and praveenkumar committed May 8, 2024
1 parent 493bde6 commit c7bc3f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows-qe-tpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
run: |
# Get origin commit sha for testing
commit_sha=$(cat gh_context.json | jq -r '.event.after')
if [[ -z "${commit_sha}" ]]; then
if [[ -z "${commit_sha}" ]] || [[ "${commit_sha}" == null ]]; then
# on first PR creation .event.after is empty, then .sha is used as commit instead
commit_sha=$(cat gh_context.json | jq -r '.sha')
commit_sha=$(cat gh_context.json | jq -r '.event.pull_request.head.sha')
fi
echo "commit_sha=${commit_sha}" >> "$GITHUB_ENV"
Expand Down

0 comments on commit c7bc3f2

Please sign in to comment.