Skip to content

Commit

Permalink
Fix tagging of uploaded ecr images
Browse files Browse the repository at this point in the history
Signed-off-by: cosa65 <[email protected]>
  • Loading branch information
cosa65 committed Aug 18, 2023
1 parent 5345e5f commit c3553f1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
# 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
# in PR synch the latest commit of the branch is found in github.sha instead
TIMESTAMP=$(date +%s)
Expand All @@ -130,10 +130,18 @@ jobs:
TIMESTAMP=""
BATCH_IMAGE_TAG=production
elif [ "${{ github.event_name }}" = "pull_request_target" ]; then
COMMIT_SHA="${{ github.sha }}"
# Construct the REF_ID for our pull request in the same format
# We can't use GITHUB_REF because it is set to master
# More info: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
PR_GITHUB_REF="refs/pull/${{ github.event.pull_request.number }}/merge"
PR_REF_ID=$(echo $PR_GITHUB_REF | sed 's/\//-/g')
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
IMAGE_TAG="$REF_ID-$COMMIT_SHA"
IMAGE_TAG="$PR_REF_ID-$COMMIT_SHA"
TIMESTAMP=$TIMESTAMP
BATCH_IMAGE_TAG=$REF_ID
BATCH_IMAGE_TAG=$PR_REF_ID
else
COMMIT_SHA=$GITHUB_SHA
IMAGE_TAG="$REF_ID-$COMMIT_SHA"
Expand Down

0 comments on commit c3553f1

Please sign in to comment.