Spaces:
Sleeping
Sleeping
RahulChhatbar
commited on
Commit
·
9cb30fa
1
Parent(s):
d77eca8
test
Browse files
.github/workflows/email-notification.yml
CHANGED
@@ -13,22 +13,40 @@ jobs:
|
|
13 |
- name: Checkout code
|
14 |
uses: actions/checkout@v3
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
- name: Send Email Notification
|
17 |
uses: cinotify/github-action@v1.6.0
|
18 |
with:
|
19 |
-
to: ${{ secrets.
|
20 |
-
subject: 'Push Notification: ${
|
21 |
body: |
|
22 |
-
<p>A push has been made to the branch ${
|
23 |
-
<p>Author: ${{
|
24 |
-
Commit Hash: ${{
|
25 |
-
Commit Date: ${{
|
26 |
-
Commit Message: ${{
|
27 |
-
Commit URL:
|
28 |
type: 'text/html'
|
|
|
29 |
env:
|
30 |
-
|
31 |
-
SMTP_PORT: ${{ secrets.SMTP_PORT }}
|
32 |
-
SMTP_USER: ${{ secrets.SMTP_USER }}
|
33 |
-
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
|
34 |
-
SMTP_FROM: ${{ secrets.SMTP_FROM }}
|
|
|
13 |
- name: Checkout code
|
14 |
uses: actions/checkout@v3
|
15 |
|
16 |
+
- name: Get Commit Details
|
17 |
+
id: commit_details
|
18 |
+
run: |
|
19 |
+
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
|
20 |
+
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
|
21 |
+
COMMIT_HASH=$(git log -1 --pretty=format:'%h')
|
22 |
+
COMMIT_DATE=$(git log -1 --pretty=format:'%cd' --date=short)
|
23 |
+
COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')
|
24 |
+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
25 |
+
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
|
26 |
+
COMMIT_URL="https://github.com/RahulChhatbar/Text-Generation/commit/${COMMIT_HASH}"
|
27 |
+
|
28 |
+
echo "AUTHOR_NAME=${AUTHOR_NAME}" >> $GITHUB_ENV
|
29 |
+
echo "AUTHOR_EMAIL=${AUTHOR_EMAIL}" >> $GITHUB_ENV
|
30 |
+
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
|
31 |
+
echo "COMMIT_DATE=${COMMIT_DATE}" >> $GITHUB_ENV
|
32 |
+
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
|
33 |
+
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
|
34 |
+
echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV
|
35 |
+
echo "COMMIT_URL=${COMMIT_URL}" >> $GITHUB_ENV
|
36 |
+
|
37 |
- name: Send Email Notification
|
38 |
uses: cinotify/github-action@v1.6.0
|
39 |
with:
|
40 |
+
to: ${{ secrets.EMAIL_TO }}
|
41 |
+
subject: 'Push Notification: ${{ env.REPO_NAME }} - ${{ env.BRANCH_NAME }}'
|
42 |
body: |
|
43 |
+
<p>A push has been made to the branch ${{ env.BRANCH_NAME }} in repository ${{ env.REPO_NAME }}!</p>
|
44 |
+
<p>Author: ${{ env.AUTHOR_NAME }} <${{ env.AUTHOR_EMAIL }}><br>
|
45 |
+
Commit Hash: ${{ env.COMMIT_HASH }}<br>
|
46 |
+
Commit Date: ${{ env.COMMIT_DATE }}<br>
|
47 |
+
Commit Message: ${{ env.COMMIT_MESSAGE }}<br>
|
48 |
+
Commit URL: ${{ env.COMMIT_URL }}</p>
|
49 |
type: 'text/html'
|
50 |
+
attachment: 'path/to/artifacts.zip' # Adjust this path as necessary
|
51 |
env:
|
52 |
+
EMAIL_TO: ${{ secrets.EMAIL_TO }}
|
|
|
|
|
|
|
|