awesome-copilot/.github/workflows/webhook-caller.yml
2025-07-11 11:09:22 +10:00

44 lines
1.1 KiB
YAML

name: Call Webhooks on Main Push
on:
push:
branches:
- main
permissions:
contents: read
actions: none
checks: none
deployments: none
issues: none
discussions: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
call-webhooks:
runs-on: ubuntu-latest
steps:
- name: Check and call webhooks
env:
WEBHOOK_URLS: ${{ secrets.WEBHOOK_URLS }}
run: |
if [ -n "$WEBHOOK_URLS" ]; then
IFS=',' read -ra URLS <<< "$WEBHOOK_URLS"
for url in "${URLS[@]}"; do
if [[ "$url" =~ ^https:// ]]; then
if ! curl -f --max-time 30 --retry 3 -X POST "$url"; then
echo "Webhook call failed for: $url" >&2
echo "Skipping invalid webhook URL (must start with https://): $url" >&2
exit 1
else
echo "Skipping invalid webhook URL (must start with https://): $url" >&2
fi
done
else
echo "No webhooks to call."
fi