Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,30 @@ jobs:
run: |
VERSION="v${{ needs.build.outputs.version }}"
REPO_NAME="${{ github.repository }}"
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/${VERSION}"
COMMIT_SHA="${{ github.sha }}"
SHORT_SHA="${COMMIT_SHA:0:7}"

MESSAGE="Version ${VERSION} deployed successfully to production.

Release Details:
- Repository: ${REPO_NAME}
- Commit: ${SHORT_SHA}
- Branch: ${{ github.ref_name }}

Available platforms:
- Linux (AMD64/ARM64)
- macOS (Intel/Apple Silicon)
- Windows (AMD64)

Release: ${RELEASE_URL}"

curl -s --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \
--form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \
--form-string "title=✅ Deploy Success: ${REPO_NAME}" \
--form-string "message=Version ${VERSION} deployed successfully to production" \
--form-string "title=[OK] Deploy Success: ${REPO_NAME}" \
--form-string "message=${MESSAGE}" \
--form-string "url=${RELEASE_URL}" \
--form-string "url_title=View Release" \
--form-string "priority=0" \
--form-string "sound=pushover" \
https://api.pushover.net/1/messages.json
Expand All @@ -194,11 +213,25 @@ jobs:
VERSION="v${{ needs.build.outputs.version }}"
REPO_NAME="${{ github.repository }}"
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
COMMIT_SHA="${{ github.sha }}"
SHORT_SHA="${COMMIT_SHA:0:7}"

MESSAGE="Version ${VERSION} deployment failed.

Details:
- Repository: ${REPO_NAME}
- Commit: ${SHORT_SHA}
- Branch: ${{ github.ref_name }}
- Workflow Run: ${{ github.run_id }}

Check the workflow logs for more information."

curl -s --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \
--form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \
--form-string "title=❌ Deploy Failed: ${REPO_NAME}" \
--form-string "message=Version ${VERSION} deployment failed. Check: ${WORKFLOW_URL}" \
--form-string "title=[FAIL] Deploy Failed: ${REPO_NAME}" \
--form-string "message=${MESSAGE}" \
--form-string "url=${WORKFLOW_URL}" \
--form-string "url_title=View Workflow Logs" \
--form-string "priority=1" \
--form-string "sound=siren" \
https://api.pushover.net/1/messages.json
50 changes: 46 additions & 4 deletions .github/workflows/pushover-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ on:
description: 'URL to the workflow run'
required: false
type: string
release_url:
description: 'URL to the release page'
required: false
type: string
commit_sha:
description: 'Commit SHA for this release'
required: false
type: string
branch:
description: 'Branch name'
required: false
type: string
secrets:
PUSHOVER_USER_KEY:
required: true
Expand All @@ -29,27 +41,57 @@ jobs:
run: |
REPO_NAME="${{ github.repository }}"
VERSION="${{ inputs.version }}"
COMMIT_SHA="${{ inputs.commit_sha }}"
SHORT_SHA="${COMMIT_SHA:0:7}"
BRANCH="${{ inputs.branch }}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional inputs lack fallback values in notification message

Low Severity

The new optional inputs commit_sha and branch are used directly in the message template without fallback handling. When callers don't provide these values, the notification displays empty lines like - Commit: and - Branch:. Unlike release_url and workflow_url which have fallbacks using github.server_url, these inputs could similarly fall back to github.sha and github.ref_name to ensure complete notification messages.

Additional Locations (2)

Fix in Cursor Fix in Web


if [ "${{ inputs.status }}" == "success" ]; then
TITLE="✅ Deploy Success: ${REPO_NAME}"
MESSAGE="Version ${VERSION} deployed successfully to production"
RELEASE_URL="${{ inputs.release_url }}"
if [ -z "${RELEASE_URL}" ]; then
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/${VERSION}"
fi

TITLE="[OK] Deploy Success: ${REPO_NAME}"
MESSAGE="Version ${VERSION} deployed successfully to production.

Release Details:
- Repository: ${REPO_NAME}
- Commit: ${SHORT_SHA}
- Branch: ${BRANCH}

Release: ${RELEASE_URL}"
PRIORITY="0"
SOUND="pushover"
URL="${RELEASE_URL}"
URL_TITLE="View Release"
else
WORKFLOW_URL="${{ inputs.workflow_url }}"
if [ -z "${WORKFLOW_URL}" ]; then
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
fi
TITLE="❌ Deploy Failed: ${REPO_NAME}"
MESSAGE="Version ${VERSION} deployment failed. Check: ${WORKFLOW_URL}"

TITLE="[FAIL] Deploy Failed: ${REPO_NAME}"
MESSAGE="Version ${VERSION} deployment failed.

Details:
- Repository: ${REPO_NAME}
- Commit: ${SHORT_SHA}
- Branch: ${BRANCH}
- Workflow Run: ${{ github.run_id }}

Check the workflow logs for more information."
PRIORITY="1"
SOUND="siren"
URL="${WORKFLOW_URL}"
URL_TITLE="View Workflow Logs"
fi

curl -s --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \
--form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \
--form-string "title=${TITLE}" \
--form-string "message=${MESSAGE}" \
--form-string "url=${URL}" \
--form-string "url_title=${URL_TITLE}" \
--form-string "priority=${PRIORITY}" \
--form-string "sound=${SOUND}" \
https://api.pushover.net/1/messages.json