From 6713e074dcc5b5ab4189dcebbdb0501d06650076 Mon Sep 17 00:00:00 2001 From: Paul Macdonnell Date: Sat, 2 May 2026 09:02:02 +1000 Subject: [PATCH] Migrate inline Slack notifications to pg-actions reusable workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces inline slackapi/slack-github-action steps with the centralised slack-notify-start and slack-notify-end reusable workflows from pg-actions. Restructures into 3-job pattern: slack-start → build → slack-end. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/docker-image.yml | 82 +++++++++--------------------- 1 file changed, 25 insertions(+), 57 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8b50ee8..68e06da 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,65 +5,33 @@ on: tags: - "*.*.*" workflow_dispatch: + jobs: + slack-start: + uses: pgmac-net/pg-actions/.github/workflows/slack-notify-start.yml@main + secrets: inherit + build-n-push: + needs: [slack-start] runs-on: self-hosted steps: - - uses: actions/checkout@v3 - - name: Set the image version - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - name: Build the Docker image - run: docker build . --file Dockerfile --tag macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} - - name: Push to my internal registry - if: github.ref == 'refs/heads/"master"' - run: docker push macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} - - name: Exit code failure - if: failure() - run: | - echo "colour=danger" >> $GITHUB_ENV - echo "icon=🛑" >> $GITHUB_ENV - - name: Exit code cancelled - if: cancelled() - run: | - echo "colour=warning" >> $GITHUB_ENV - echo "icon=⚠" >> $GITHUB_ENV - - name: Exit code success - if: success() - run: | - echo "colour=good" >> $GITHUB_ENV - echo "icon=✅" >> $GITHUB_ENV + - uses: actions/checkout@v3 + - name: Set the image version + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: Build the Docker image + run: docker build . --file Dockerfile --tag macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} + - name: Push to my internal registry + if: github.ref == 'refs/heads/"master"' + run: docker push macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} - - name: Send Slack message - uses: slackapi/slack-github-action@v1.23.0 - with: - payload: | - { - "channel": "builds", - "attachments": [ - { - "mrkdwn_in": ["text", "pretext"], - "fallback": ${{ toJSON(join(github.event.commits.*.message, '
') || ':point_right: Manually triggered') }}, - "color": "${{ env.colour || 'grey' }}", - "pretext": "${{ env.icon || '?' }} ${{ github.workflow }} (${{ github.ref_name }}) #${{ github.run_number }}", - "author_name": "${{ github.triggering_actor || github.actor }}", - "title": "${{ github.workflow }}", - "title_link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "text": ${{ toJSON(join(github.event.commits.*.message, '\n') || ':point_right: Manually triggered') }} - }, - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "<${{ github.event.pull_request.html_url || github.event.head_commit.url || github.server_url }}|View commit>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + slack-end: + if: always() + needs: [slack-start, build-n-push] + uses: pgmac-net/pg-actions/.github/workflows/slack-notify-end.yml@main + with: + ts: ${{ needs.slack-start.outputs.ts }} + start: ${{ needs.slack-start.outputs.start }} + startfmt: ${{ needs.slack-start.outputs.startfmt }} + status: ${{ needs.build-n-push.result }} + secrets: inherit