5
5
pull_request_target :
6
6
types :
7
7
- closed
8
-
9
- jobs :
8
+
9
+ jobs :
10
10
send_email :
11
- # run this workflow step only when the PR is merged
12
- if : github.event.pull_request.merged == true
13
- runs-on : ubuntu-latest
11
+ # run this workflow step only when the PR is merged
12
+ if : github.event.pull_request.merged == true
13
+ runs-on : ubuntu-latest
14
14
steps :
15
15
- name : print git events
16
- run : cat "$GITHUB_EVENT_PATH"
16
+ run : cat "$GITHUB_EVENT_PATH"
17
17
- name : print GitHub context
18
18
env :
19
19
GITHUB_CONTEXT : ${{ toJson(github) }}
20
- run : echo "$GITHUB_CONTEXT"
20
+ run : echo "$GITHUB_CONTEXT"
21
21
# This workflow step will parse github env. The parsed env will be used in the email body.
22
22
- name : get commits payload
23
23
id : build-payload
24
24
env :
25
25
PR_LINK : ${{github.event.pull_request._links.html.href}}
26
- run : |
27
- echo "LINK=$(echo $PR_LINK )" >> $GITHUB_ENV
26
+ run : |
27
+ echo "LINK=$(echo $PR_LINK )" >> $GITHUB_ENV
28
28
echo "AUTHOR=$(echo ${{github.event.pull_request.head.user.login}})" >> $GITHUB_ENV
29
- echo "COMPARE_URL= $( echo '${{github.event.repository.html_url}}/compare/${{github.event.pull_request.base.sha}}...${{github.event.pull_request.head.sha}}' )" >> $GITHUB_ENV
30
- echo "FILES_CHANGED=$(echo '$PR_LINK/files' )" >> $GITHUB_ENV
31
-
29
+ echo "COMPARE_URL= $( echo '${{github.event.repository.html_url}}/compare/${{github.event.pull_request.base.sha}}...${{github.event.pull_request.head.sha}}' )" >> $GITHUB_ENV
30
+ echo "FILES_CHANGED=$(echo '$PR_LINK/files' )" >> $GITHUB_ENV
31
+
32
32
- name : checkout
33
- uses : actions/checkout@v3
33
+ uses : actions/checkout@v4
34
34
# To get git diff on the files that were changed in the PR checkout with fetch-depth 2.
35
35
with :
36
- fetch-depth : 0
37
- # this step will (1) get the merge log for the merge_commit_sha and save it to the git actions EN for later use in the email body.
36
+ fetch-depth : 0
37
+ # this step will (1) get the merge log for the merge_commit_sha and save it to the git actions EN for later use in the email body.
38
38
# (2) Get the files changed on the merge commit using the git log --name-status command.
39
39
- name : Get merge log
40
40
id : merge-log
41
41
env :
42
42
MERGE_SHA : ${{github.event.pull_request.merge_commit_sha}}
43
- run : |
43
+ run : |
44
44
merge_log=$(git show -s --format=%B $MERGE_SHA )
45
- echo "$merge_log"
45
+ echo "$merge_log"
46
46
echo 'MERGE<<EOF' >> $GITHUB_ENV
47
47
echo "$merge_log" >> $GITHUB_ENV
48
48
echo 'EOF' >> $GITHUB_ENV
@@ -52,12 +52,12 @@ jobs:
52
52
diff_max_lines=1000
53
53
diff=$(echo "$diff" | awk "NR <= $diff_max_lines; NR > $diff_max_lines { print \"(diff output truncated at $diff_max_lines lines)\"; exit }")
54
54
55
- echo "$diff"
55
+ echo "$diff"
56
56
echo 'DIFF<<EOF' >> $GITHUB_ENV
57
57
echo "$diff" >> $GITHUB_ENV
58
- echo 'EOF' >> $GITHUB_ENV
59
-
60
- - name : Send mail
58
+ echo 'EOF' >> $GITHUB_ENV
59
+
60
+ - name : Send mail
61
61
uses : dawidd6/action-send-mail@v3
62
62
with :
63
63
# Required mail server address if not connection_url:
66
66
# Optional whether this connection use TLS (default is true if server_port is 465)
67
67
secure : true
68
68
# Optional (recommended): mail server username:
69
- username : ${{ secrets.MAIL_USERNAME}}
69
+ username : ${{ secrets.MAIL_USERNAME}}
70
70
# Optional (recommended) mail server password:
71
71
password : ${{secrets.MAIL_PASSWORD}}
72
72
# Required mail subject:
@@ -76,18 +76,18 @@ jobs:
76
76
# Required sender full name (address can be skipped):
77
77
from : ${{env.AUTHOR}}
78
78
body : |
79
-
80
- Branch: ${{github.ref}}
81
- Revision: ${{ github.event.pull_request.merge_commit_sha }}
82
- Author: ${{ env.AUTHOR}}
83
- Link: ${{github.event.pull_request._links.html.href}}
84
- Log Message:
85
- ${{env.MERGE}}
79
+
80
+ Branch: ${{github.ref}}
81
+ Revision: ${{ github.event.pull_request.merge_commit_sha }}
82
+ Author: ${{ env.AUTHOR}}
83
+ Link: ${{github.event.pull_request._links.html.href}}
84
+ Log Message:
85
+ ${{env.MERGE}}
86
86
87
87
Compare: ${{env.COMPARE_URL}}
88
88
89
- Diff:
90
- ${{env.DIFF}}
89
+ Diff:
90
+ ${{env.DIFF}}
91
91
${{github.event.pull_request.diff_url}}
92
92
# Optional priority: 'high', 'normal' (default) or 'low'
93
93
priority : low
0 commit comments