Skip to content

Commit

Permalink
Merge pull request #39 from sounddrill31/tg-notifs-2
Browse files Browse the repository at this point in the history
Telegram Notifications
  • Loading branch information
sounddrill31 authored Jun 26, 2024
2 parents 669247b + ca4c65a commit b87c9d0
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 17 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,18 @@ jobs:
# Send Build 'start' notification
- name: Telegram Notification
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has been queued %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: "Build Started"
Expand Down Expand Up @@ -422,8 +432,19 @@ jobs:
- name: Telegram Notification
if: ${{ success() || cancelled() || failure() }}
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has status: $jobStatus %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
# Todo: error.log link
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: ${{ job.status }}
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,18 @@ jobs:
# Send Build 'start' notification
- name: Telegram Notification
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has been queued %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: "Build Started"
Expand Down Expand Up @@ -449,8 +459,19 @@ jobs:
- name: Telegram Notification
if: ${{ success() || cancelled() || failure() }}
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has status: $jobStatus %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
# Todo: error.log link
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: ${{ job.status }}
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/twrp-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,18 @@ jobs:
# Send Build 'start' notification
- name: Telegram Notification
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has been queued %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: "Build Started"
Expand Down Expand Up @@ -351,8 +361,19 @@ jobs:
- name: Telegram Notification
if: ${{ success() || cancelled() || failure() }}
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has status: $jobStatus %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
# Todo: error.log link
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: ${{ job.status }}
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/twrp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,18 @@ jobs:
# Send Build 'start' notification
- name: Telegram Notification
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has been queued %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: "Build Started"
Expand Down Expand Up @@ -351,8 +361,19 @@ jobs:
- name: Telegram Notification
if: ${{ success() || cancelled() || failure() }}
continue-on-error: true
uses: xinthink/[email protected]
with:
run: |
send_telegram_message() {
local message="$1"
curl -s -X POST \
https://api.telegram.org/bot$botToken/sendMessage \
-d chat_id=$chatId \
-d text="$message" \
-d parse_mode="Markdown"
}
send_telegram_message "Crave ProjectID: $PROJECTID %0ABuild for ${{ github.event.inputs.DEVICE_NAME }} has status: $jobStatus %0ACheck Progress at: %0Ahttps://github.com/$(echo "${{ github.repository }}" | sed 's@_@\\_@g')/actions/runs/${{ github.run_id }}"
# Todo: error.log link
env:
chatId: ${{ secrets.TELEGRAM_TO }}
botToken: ${{ secrets.TELEGRAM_TOKEN }}
jobStatus: ${{ job.status }}
Expand Down
2 changes: 1 addition & 1 deletion scripts/code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ ! -f ~/.config/code-server/config.yaml ] || ! grep -q "bind-addr: 0.0.0.0:5
if [[ $REPLY =~ ^[Yy]$ ]] || [[ $1 == "--quiet" ]]; then
echo "Downloading..."
rm ~/.config/code-server/config.yaml 2> /dev/null
curl -o ~/.config/code-server/config.yaml https://raw.githubusercontent.com/sounddrill31/crave_aosp_builder/main/configs/code-server/config.yaml
curl -o ~/.config/code-server/config.yaml https://raw.githubusercontent.com/${{ github.repository }}/main/configs/code-server/config.yaml
else
echo "Skipping..."
exit 1
Expand Down

0 comments on commit b87c9d0

Please sign in to comment.