Skip to content

Merge pull request #29 from Arseno25/tes/notif-test #8

Merge pull request #29 from Arseno25/tes/notif-test

Merge pull request #29 from Arseno25/tes/notif-test #8

Workflow file for this run

name: Notify on Merge
on:
push:
branches:
- '*'
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch updates from origin
run: git fetch origin development
- name: Get PR number
id: pr
run: echo "PR_NUMBER=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
- name: Get PR source branch
id: pr_source_branch
run: echo "PR_SOURCE_BRANCH=$(git show --no-patch --format='%B' ${{ steps.pr.outputs.PR_NUMBER }} | grep -oP 'from \K\w+')" >> $GITHUB_ENV
- name: Get PR target branch
id: pr_target_branch
run: echo "PR_TARGET_BRANCH=$(git show --no-patch --format='%B' ${{ steps.pr.outputs.PR_NUMBER }} | grep -oP 'to \K\w+')" >> $GITHUB_ENV
- name: Get commit author
id: commit_author
run: echo "COMMIT_AUTHOR=$(git show --no-patch --format='%an' ${{ steps.pr.outputs.PR_NUMBER }})" >> $GITHUB_ENV
- name: Send Telegram Notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: "PR ${{ steps.pr.outputs.PR_NUMBER }} merged from ${{ steps.pr_source_branch.outputs.PR_SOURCE_BRANCH }} to ${{ steps.pr_target_branch.outputs.PR_TARGET_BRANCH }} by ${{ steps.commit_author.outputs.COMMIT_AUTHOR }}"