Skip to content

Commit

Permalink
Update image-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepstaylor committed Nov 12, 2024
1 parent 5b2fe1b commit 4d3b894
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Create safe tag for image
id: safe_tag
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
if [ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.ref }}" != "main" ]; then
echo "SAFE_TAG=$(echo ${{ github.event.pull_request.head.ref }} | sed 's/[^a-zA-Z0-9.]/-/g')-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_OUTPUT
else
echo "SAFE_TAG=$(echo ${{ inputs.tag }} | sed 's/[^a-zA-Z0-9.]/-/g')" >> $GITHUB_OUTPUT
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Output VERSION_REF
id: output_version_ref
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
if [ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.ref }}" != "main" ]; then
# if on a PR we need to get the current branch name
echo "VERSION_REF=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
if: github.event_name == 'pull_request'
run: |
gh pr comment ${{ github.event.pull_request.number }} --body "Image built and pushed to ghcr.io/ministryofjustice/hmpps-ldap-automation:${{ steps.safe_tag.outputs.SAFE_TAG }}"
gh pr comment ${{ github.event.pull_request.number }} --body "Image built and pushed to `ghcr.io/ministryofjustice/hmpps-ldap-automation:${{ steps.safe_tag.outputs.SAFE_TAG }}`"
- name: Slack failure notification
if: ${{ failure() }}
Expand Down

0 comments on commit 4d3b894

Please sign in to comment.