opt: fix ntfy
This commit is contained in:
@@ -69,6 +69,8 @@ runs:
|
|||||||
NTFY_TOPIC: ${{ inputs.ntfy_topic || 'act_runner_deployment' }}
|
NTFY_TOPIC: ${{ inputs.ntfy_topic || 'act_runner_deployment' }}
|
||||||
NTFY_USERNAME: ${{ inputs.ntfy_username || env.NTFY_AUTH_USER }}
|
NTFY_USERNAME: ${{ inputs.ntfy_username || env.NTFY_AUTH_USER }}
|
||||||
NTFY_PASSWORD: ${{ inputs.ntfy_password || env.NTFY_AUTH_PASS }}
|
NTFY_PASSWORD: ${{ inputs.ntfy_password || env.NTFY_AUTH_PASS }}
|
||||||
|
|
||||||
|
# Git
|
||||||
GIT_URL: ${{ inputs.server_url || 'https://git.hcmc.online' }}
|
GIT_URL: ${{ inputs.server_url || 'https://git.hcmc.online' }}
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||||
|
|||||||
21
notify.sh
21
notify.sh
@@ -42,18 +42,35 @@ send_ntfy() {
|
|||||||
echo -e " Auth: ${YELLOW}None (Public)${NC}"
|
echo -e " Auth: ${YELLOW}None (Public)${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo -e " ${YELLOW}→${NC} Sending push notification..."
|
echo -e " ${YELLOW}→${NC} Sending push notification..."
|
||||||
|
echo -e " ${YELLOW}Debug - Raw MESSAGE:${NC}"
|
||||||
|
echo "$MESSAGE" | sed 's/^/ RAW: /'
|
||||||
|
echo -e " ${YELLOW}Debug - Interpreted MESSAGE:${NC}"
|
||||||
|
echo -e "$MESSAGE" | sed 's/^/ INT: /'
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Create temp file with message content
|
||||||
|
local temp_msg=$(mktemp)
|
||||||
|
echo -e "$MESSAGE" > "$temp_msg"
|
||||||
|
|
||||||
|
echo -e " ${YELLOW}Debug - Temp file content:${NC}"
|
||||||
|
cat "$temp_msg" | sed 's/^/ FILE: /'
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Disable exit on error for curl
|
# Disable exit on error for curl
|
||||||
set +e
|
set +e
|
||||||
response=$(printf "%s" "$MESSAGE" | curl -s -w "\n%{http_code}" --http1.1 -k $auth_args -X POST "$NTFY_URL/$NTFY_TOPIC" \
|
response=$(curl -s -w "\n%{http_code}" --http1.1 -k $auth_args \
|
||||||
|
-X POST "$NTFY_URL/$NTFY_TOPIC" \
|
||||||
-H "Title: $ICON $TITLE" \
|
-H "Title: $ICON $TITLE" \
|
||||||
-H "Priority: 4" \
|
-H "Priority: 4" \
|
||||||
-H "Click: $click_url" \
|
-H "Click: $click_url" \
|
||||||
-H "Actions: view, Open Logs, $click_url" \
|
-H "Actions: view, Open Logs, $click_url" \
|
||||||
--data-binary @- 2>&1)
|
-T "$temp_msg" 2>&1)
|
||||||
curl_exit_code=$?
|
curl_exit_code=$?
|
||||||
|
|
||||||
|
# Clean up temp file
|
||||||
|
rm -f "$temp_msg"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Check curl exit code
|
# Check curl exit code
|
||||||
|
|||||||
Reference in New Issue
Block a user