Skip to content

Commit

Permalink
send message
Browse files Browse the repository at this point in the history
  • Loading branch information
tranphuocloc070699 committed Jul 28, 2023
1 parent a21142b commit c90702a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/backend-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,14 @@ jobs:
disable_web_page_preview: true
- name: Check last job status
id: lastJobStatus
continue-on-error: true
if: ${{always() && failure()}}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_BLOG_CHANEL_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
<strong >FAILURE ❌</strong>
Actor: <strong>${{ github.actor }}</strong>
Branch: <strong>${{ steps.extract_branch.outputs.branch }}</strong>
Repository: <strong>${{ github.repository }}</strong>
<a href="https://github.com/${{ github.repository }}/commit/${{github.sha}}"><strong>Open URL</strong></a>
format: html
disable_web_page_preview: true
run: |
echo "Job status is ${{ job.status }}"
echo "error_message=$(tail -n 10000 ${{ github.workspace }}/path/to/your/log/file.log)" >> $GITHUB_OUTPUT
send-telegram-message:
needs: deploy
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Telegram message on fail
if: ${{ steps.check-status.outcome == 'failure' }}
- name: Send message whenever job fail
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_BLOG_CHANEL_ID }}
Expand All @@ -124,7 +110,8 @@ jobs:
Actor: <strong>${{ github.actor }}</strong>
Branch: <strong>${{ steps.extract_branch.outputs.branch }}</strong>
Repository: <strong>${{ github.repository }}</strong>
<a href="https://github.com/${{ github.repository }}/commit/${{github.sha}}"><strong>Open URL</strong></a>
Message: <pre>${{ steps.lastJobStatus.outputs.error_message }}</pre>
format: html
disable_web_page_preview: true
disable_web_page_preview: true
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ServerApplication {
public static void main(String[] args) {

SpringApplication.run(ServerApplication.class, args);

System.out.println("abcxyz");
}

}

0 comments on commit c90702a

Please sign in to comment.