Files
scst/.github/workflows/mail_notification.yml
Gleb Chesnokov 6b419bde6b github: Change mail server for mail notification action
Google no longer support the use of third-party apps or devices which
ask you to sign in to your Google Account using only your username and
password. This causes problems when using github mail notification action
to send SCST patches. Hence, change the Google mail server to an another one.
2022-05-15 16:13:55 +03:00

109 lines
3.4 KiB
YAML

# Send commits info to SCST mailing list on push
name: Mailing list
on:
push:
branches:
- 3.6.x
- master
jobs:
send_mails:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
commit: ${{github.event.commits}}
steps:
- name: Checkout Project
uses: actions/checkout@v2
with:
ref: ${{matrix.commit.id}}
fetch-depth: 2
- name: Get short ref
id: get_short_ref
run: |
echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
- name: Get commit id
id: get_comm_id
run: |
echo ::set-output name=comm_id::$(git rev-parse --short HEAD)
- name: Get commit message
id: get_comm_message
run: |
echo ::set-output name=comm_message::$(git log --format=%s -n 1 HEAD)
- name: Get list of files
id: get_list_files
run: |
files="$(git diff-tree --no-commit-id --stat --stat-name-width=60 --stat-graph-width=15 -r HEAD)"
files="${files//'%'/'%25'}"
files="${files//$'\n'/'%0A'}"
files="${files//$'\r'/'%0D'}"
echo ::set-output name=files::"$files"
- name: Get commit diff
id: get_comm_diff
run: |
if [ $(git show --no-patch --format="%P" | wc -w) -eq 1 ]; then
diff="$(git --no-pager diff -p HEAD^1)"
diff="${diff//'%'/'%25'}"
diff="${diff//$'\n'/'%0A'}"
diff="${diff//$'\r'/'%0D'}"
echo ::set-output name=comm_diff::"$diff"
fi
- name: Send mail
uses: dawidd6/action-send-mail@v3
with:
# Required mail server address:
server_address: smtp.yandex.com
# Required mail server port:
server_port: 465
# Optional (recommended): mail server username:
username: ${{secrets.MAIL_SERVER_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.MAIL_SERVER_PASSWORD}}
# Required mail subject:
subject: |
[${{steps.get_short_ref.outputs.short_ref}}] ${{steps.get_comm_message.outputs.comm_message}}
# Required recipients' addresses:
to: scst-svn@lists.sourceforge.net
# Required sender full name (address can be skipped):
from: ${{matrix.commit.committer.name}}
# Optional whether this connection use TLS (default is true if server_port is 465)
# secure: true
# Optional plain body:
body: |
Commit: ${{steps.get_comm_id.outputs.comm_id}}
GitHub URL: ${{matrix.commit.url}}
Author: ${{matrix.commit.author.name}}
Date: ${{matrix.commit.timestamp}}
Log Message:
-----------
${{matrix.commit.message}}
Modified Paths:
--------------
${{steps.get_list_files.outputs.files}}
===================================================================
${{steps.get_comm_diff.outputs.comm_diff}}
# Optional unsigned/invalid certificates allowance:
ignore_cert: true
# Optional converting Markdown to HTML (set content_type to text/html too):
# convert_markdown: true
# Optional attachments:
# attachments: attachments.zip,git.diff,./dist/static/*.js
# Optional priority: 'high', 'normal' (default) or 'low'
# priority: low