-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
52 lines (50 loc) · 2.16 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: 'Recognize Change Notification Action'
description: 'Get notified when a specific file is changed.'
inputs:
notification-type:
description: 'Type of notification. Currently, only email is supported.'
required: true
default: 'email'
path:
description: 'File or directory to track for changes.'
required: true
mail-connection-url:
description: 'Mail connection URL (smtp+starttls://user:password@server:port, smtp://user:password@server:port).'
required: true
mail-subject:
description: 'Subject of the mail that will be send upon a change.'
required: true
mail-from-name:
description: 'The name of the sender from which the notification will be sent.'
required: true
mail-from-address:
description: 'From which mail address the notification will be sent.'
required: true
mail-to:
description: 'The mail addresses that should receive the notification (separated by a comma).'
required: true
runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
name: Checkout files
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: jitterbit/get-changed-files@v1
with:
format: json
- name: Send email notification
if: ${{ contains(steps.changed-files.outputs.all, format('"{0}', inputs.path)) && inputs.notification-type == 'email' }}
uses: dawidd6/action-send-mail@v3
with:
connection_url: ${{ inputs.mail-connection-url }}
subject: ${{ inputs.mail-subject }}
from: ${{ format('{0} <{1}>', inputs.mail-from-name, inputs.mail-from-address) }}
to: ${{ inputs.mail-to }}
html_body: |-
# ${{ inputs.mail-subject }}
The path ${{ inputs.path }} has been changed. To see the changes, please visit the following link:
[${{ github.event.repository.html_url }}/commit/${{ github.sha }}](${{ github.event.repository.html_url }}/commit/${{ github.sha }})
convert_markdown: true