Send Changelog Email #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Send Changelog Email | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Ferry Run"] | |
types: | |
- completed | |
jobs: | |
send_mail: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: coursetable/ferry-data | |
path: data | |
ssh-key: ${{ secrets.REPO_SSH_KEY }} | |
sparse-checkout: | | |
change_log/ | |
sparse-checkout-cone-mode: false | |
fetch-depth: 1 | |
# Find the latest changelog file | |
- name: Find latest changelog file | |
id: find_changelog | |
run: | | |
FILE=$(ls data/change_log/*.md | sort | tail -n 1) | |
echo "FILE=$FILE" >> $GITHUB_ENV | |
# Extract the date/time from the filename | |
- name: Extract changelog date/time | |
run: | | |
FILE_NAME=$(basename "${FILE}") | |
DATE_TIME="${FILE_NAME%.md}" | |
echo "CHANGELOG_DATE_TIME=${DATE_TIME}" >> $GITHUB_ENV | |
- name: Send changelog email | |
uses: dawidd6/action-send-mail@v4 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 587 | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
from: "CourseTable <[email protected]>" | |
to: ${{ secrets.MAIL_RECIPIENTS }} | |
subject: "[FERRY] Changelog - ${{ env.CHANGELOG_DATE_TIME }}" | |
html_body: "file://${{ env.FILE }}" | |
convert_markdown: true | |