name: Email Notification on: push: branches: - main jobs: notify: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Get Commit Details id: commit_details run: | AUTHOR_NAME=$(git log -1 --pretty=format:'%an') AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae') COMMIT_HASH=$(git log -1 --pretty=format:'%h') COMMIT_DATE=$(git log -1 --pretty=format:'%cd' --date=short) COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s') BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) REPO_NAME=$(basename $(git rev-parse --show-toplevel)) COMMIT_URL="https://github.com/RahulChhatbar/TextGenPro/commit/${COMMIT_HASH}" echo "AUTHOR_NAME=${AUTHOR_NAME}" >> $GITHUB_ENV echo "AUTHOR_EMAIL=${AUTHOR_EMAIL}" >> $GITHUB_ENV echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV echo "COMMIT_DATE=${COMMIT_DATE}" >> $GITHUB_ENV echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV echo "COMMIT_URL=${COMMIT_URL}" >> $GITHUB_ENV - name: Send Email Notification to primary email uses: cinotify/github-action@v1.6.0 with: to: ${{ secrets.EMAIL_TO_1 }},${{ secrets.EMAIL_TO_2 }} subject: 'Push Notification: ${{ env.REPO_NAME }} - ${{ env.BRANCH_NAME }}' body: |

A push has been made to the branch ${{ env.BRANCH_NAME }} in repository ${{ env.REPO_NAME }}!

Author: ${{ env.AUTHOR_NAME }} <${{ env.AUTHOR_EMAIL }}>
Commit Hash: ${{ env.COMMIT_HASH }}
Commit Date: ${{ env.COMMIT_DATE }}
Commit Message: ${{ env.COMMIT_MESSAGE }}
Commit URL: ${{ env.COMMIT_URL }}

type: 'text/html' env: EMAIL_TO_1: ${{ secrets.EMAIL_TO_1 }} EMAIL_TO_2: ${{ secrets.EMAIL_TO_2 }}