fix(ci): bound telegram notify time in workflows
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 1m42s
CI/CD Pipeline / Run Tests (pull_request) Failing after 20m33s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been cancelled
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 1m42s
CI/CD Pipeline / Run Tests (pull_request) Failing after 20m33s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been cancelled
This commit is contained in:
@@ -63,6 +63,7 @@ jobs:
|
||||
|
||||
- name: Telegram notify (lint failed)
|
||||
if: failure()
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then
|
||||
@@ -78,9 +79,16 @@ jobs:
|
||||
actor=${GITHUB_ACTOR}
|
||||
commit=${COMMIT_MESSAGE}"
|
||||
|
||||
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
curl -fsS \
|
||||
--connect-timeout 5 \
|
||||
--max-time 15 \
|
||||
--retry 2 \
|
||||
--retry-delay 2 \
|
||||
--retry-all-errors \
|
||||
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
-d "chat_id=${TG_CHANNEL}" \
|
||||
--data-urlencode "text=${MSG}"
|
||||
--data-urlencode "text=${MSG}" \
|
||||
|| echo "Telegram notification failed; continue pipeline"
|
||||
|
||||
test:
|
||||
name: Run Tests
|
||||
@@ -128,6 +136,7 @@ jobs:
|
||||
|
||||
- name: Telegram notify (test failed)
|
||||
if: failure()
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then
|
||||
@@ -143,13 +152,21 @@ jobs:
|
||||
actor=${GITHUB_ACTOR}
|
||||
commit=${COMMIT_MESSAGE}"
|
||||
|
||||
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
curl -fsS \
|
||||
--connect-timeout 5 \
|
||||
--max-time 15 \
|
||||
--retry 2 \
|
||||
--retry-delay 2 \
|
||||
--retry-all-errors \
|
||||
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
-d "chat_id=${TG_CHANNEL}" \
|
||||
--data-urlencode "text=${MSG}"
|
||||
--data-urlencode "text=${MSG}" \
|
||||
|| echo "Telegram notification failed; continue pipeline"
|
||||
|
||||
notify_success:
|
||||
name: Telegram Notify Success
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 1
|
||||
needs: [lint, test]
|
||||
if: |
|
||||
always() &&
|
||||
@@ -160,6 +177,7 @@ jobs:
|
||||
TG_CHANNEL: ${{ secrets.TG_CHANNEL }}
|
||||
steps:
|
||||
- name: Telegram notify (lint+test success)
|
||||
continue-on-error: true
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
@@ -175,6 +193,13 @@ jobs:
|
||||
actor=${GITHUB_ACTOR}
|
||||
commit=${COMMIT_MESSAGE:-n/a}"
|
||||
|
||||
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
curl -fsS \
|
||||
--connect-timeout 5 \
|
||||
--max-time 15 \
|
||||
--retry 2 \
|
||||
--retry-delay 2 \
|
||||
--retry-all-errors \
|
||||
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
-d "chat_id=${TG_CHANNEL}" \
|
||||
--data-urlencode "text=${MSG}"
|
||||
--data-urlencode "text=${MSG}" \
|
||||
|| echo "Telegram notification failed; continue pipeline"
|
||||
|
||||
Reference in New Issue
Block a user