Skip to content

pushover

pushover #1676

Workflow file for this run

name: pushover
on:
workflow_dispatch:
inputs:
message:
description: "The body of the notification"
required: true
priority:
description: "Message priority, an integer from -2 to 2, see: https://pushover.net/api#priority; defaults to 0 (normal priority)"
required: true
default: 0
title:
description: "The title of the notification; if not provided, the application's name will be used"
required: false
device:
description: "The name of the device to send the notification to; if not provided, the notification will be sent to all devices"
required: false
jobs:
send-notification:
runs-on: ubuntu-latest
name: Pushover
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read and set Pushover environment
run: |
# mask inputs
export MESSAGE=$(jq -r '.inputs.message' $GITHUB_EVENT_PATH)
echo "message=$MESSAGE" >> $GITHUB_ENV; echo "::add-mask::$MESSAGE"
export PRIORITY=$(jq -r '.inputs.priority' $GITHUB_EVENT_PATH)
echo "priority=$PRIORITY" >> $GITHUB_ENV; echo "::add-mask::$PRIORITY"
export TITLE=$(jq -r '.inputs.title' $GITHUB_EVENT_PATH)
echo "title=$TITLE" >> $GITHUB_ENV; echo "::add-mask::$TITLE"
export DEVICE=$(jq -r '.inputs.device' $GITHUB_EVENT_PATH)
echo "device=$DEVICE" >> $GITHUB_ENV; echo "::add-mask::$DEVICE"
# set and mask variables from Pushover environment file
export $(echo "$PO_ENV")
echo "po_key=$PO_KEY" >> $GITHUB_ENV; echo "::add-mask::$PO_KEY"
echo "po_token=$PO_TOKEN" >> $GITHUB_ENV; echo "::add-mask::$PO_TOKEN"
shell: bash
env:
PO_ENV: ${{ secrets.po_env }}
- name: Pushover
uses: ./actions/pushover
with:
message: ${{ env.message }}
priority: ${{ env.priority }}
title: ${{ env.title }}
device: ${{ env.device }}
po_key: ${{ env.po_key }}
po_token: ${{ env.po_token }}