diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 34bf61c2f8..9661ff9393 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -151,8 +151,14 @@ jobs: # this is what we push to ECR # we will also take semver'd tags like `1.0.0` and use them for releases + # In push & PR events we want the tag to contain the latest commit on the branch: + # in push events, the latest commit of the master branch is GITHUB_SHA + # in PR synch the latest commit of the branch is found in github.event.pull_request.head.sha instead + if [ "${{ github.event_name }}" = "release" ] && [ "${{ github.event.action }}" = "released" ]; then echo "::set-output name=tag::${REF_ID/refs-tags-/}" + elif [ "${{ github.event_name }}" = "pull_request" ]; then + echo "::set-output name=tag::$REF_ID-${{ github.event.pull_request.head.sha }}" else echo "::set-output name=tag::$REF_ID-$GITHUB_SHA" fi diff --git a/.github/workflows/pr_validate.yaml b/.github/workflows/pr_validate.yaml index f244104d31..d704e4b892 100644 --- a/.github/workflows/pr_validate.yaml +++ b/.github/workflows/pr_validate.yaml @@ -140,9 +140,9 @@ jobs: if: steps.check-e2e-run.outputs.should-e2e-run == 'true' name: Get details of last commit run: |- - echo "SHA of GitHub merge commit:" - echo $GITHUB_SHA - echo "::set-output name=github_sha::$GITHUB_SHA" + echo "SHA of latest GitHub branch commit:" + echo ${{ github.event.pull_request.head.sha }} + echo "::set-output name=github_sha::${{ github.event.pull_request.head.sha }}" REPO_NAME=$(echo $GITHUB_REPOSITORY | awk -F '/' '{print $2}') echo "Repo name:"