fix(pushover): add optional_int function, return None for empty strings and update priority argument type (#5)
All checks were successful
Release / Create Release (push) Successful in 29s
Release / Print Release (push) Successful in 1s

Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2026-03-13 20:49:44 +00:00
parent d4aab75f9c
commit 8dc74aed03
2 changed files with 15 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
name: Conventional Commit
name: Validate PR Title
on:
pull_request:
types:
@@ -8,7 +8,9 @@ on:
- reopened
jobs:
validate_pr_title:
uses: https://git.tainton.uk/actions/gha-workflows/.gitea/workflows/conventional-commit.yml@main
with:
commit_message: ${{ gitea.event.pull_request.title }}
validate:
runs-on: ubuntu-latest
steps:
- uses: https://git.tainton.uk/actions/conventional-commits-check-action@v1.3.0
with:
commit-message: ${{ gitea.event.pull_request.title }}

View File

@@ -4,6 +4,12 @@ import argparse
import requests
def optional_int(value):
"""Convert string to int, treating empty strings as None"""
if value == '':
return None
return int(value)
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--message', type=str, help='Message text')
@@ -11,7 +17,7 @@ def get_args():
parser.add_argument('--url', type=str, help='Supplementary URL to show with your message')
parser.add_argument('--url_title', type=str, help='title for your supplementary URL, otherwise just the URL is shown')
parser.add_argument('--device', type=str, help='Device name to send the message directly to')
parser.add_argument('--priority', type=int, help='Notification priority (low-to-high: -2 to 1)')
parser.add_argument('--priority', type=optional_int, help='Notification priority (low-to-high: -2 to 1)')
parser.add_argument('--sound', type=str, help='The name of a supported sound (https://pushover.net/api#sounds; custom sounds are supported)')
args = parser.parse_args()
return args
@@ -48,7 +54,7 @@ def main():
if device:
payload['device'] = device
if priority:
payload['priority'] = priority
payload['priority'] = str(priority)
if sound:
payload['sound'] = sound