Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram Notifications #39

Merged
merged 10 commits into from
Jun 26, 2024
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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/action-telegram@v1.1
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
Loading