DBZ-4653 Cron-based doc changes workflow
This commit is contained in:
parent
47b2a53a90
commit
61e7e71a9d
46
.github/workflows/doc-changes-workflow.yml
vendored
Normal file
46
.github/workflows/doc-changes-workflow.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# This workflow is designed to notify a given email address with pertinent information
|
||||
# about changes to the Documentation files, using a cron-based trigger.
|
||||
|
||||
name: Documentation Changes
|
||||
|
||||
on:
|
||||
# Schedule job to run at midnight UTC every Saturday
|
||||
schedule:
|
||||
- cron: "0 0 * * 6"
|
||||
|
||||
jobs:
|
||||
|
||||
script:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout action
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# This is necessary as this script needs to examine all history and prepare an output
|
||||
# report that defines all changes made to the Documentation within the last number of
|
||||
# days.
|
||||
fetch-depth: 0
|
||||
# Always run this against main
|
||||
ref: 'main'
|
||||
|
||||
- name: Run script
|
||||
id: changes
|
||||
run: |
|
||||
./github-support/notify-documentation-changes.sh "main"
|
||||
CHANGES=$(cat documentation_changes.txt)
|
||||
echo "CHANGES<<EOF" >> $GITHUB_ENV
|
||||
echo "$CHANGES" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Send email notification
|
||||
uses: zulip/github-actions-zulip/send-message@v1
|
||||
with:
|
||||
api-key: ${{ secrets.ZULIP_TOKEN }}
|
||||
email: ${{ secrets.ZULIP_TOKEN_EMAIL_ADDRESS }}
|
||||
organization-url: "https://debezium.zulipchat.com"
|
||||
to: "documentation"
|
||||
type: "stream"
|
||||
topic: "activity"
|
||||
content: ${{ env.CHANGES }}
|
||||
|
25
github-support/notify-documentation-changes.sh
Executable file
25
github-support/notify-documentation-changes.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ouo > /dev/null 2>&1
|
||||
|
||||
GIT_SINCE="1.weeks"
|
||||
GITHUB_COMMIT_URL="https://github.com/debezium/debezium/commit/"
|
||||
OUTPUT="documentation_changes.txt"
|
||||
GIT_OUTPUT_FILE="git_history.txt"
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
# Get the history from Git
|
||||
git log --pretty=oneline --follow --since=$GIT_SINCE -- documentation > $GIT_OUTPUT_FILE
|
||||
|
||||
rm -f $OUTPUT
|
||||
echo "The following Debezium documentation changes have been made in the last 7 days on branch \"$GIT_BRANCH\":" >> $OUTPUT
|
||||
echo "" >> $OUTPUT
|
||||
|
||||
while IFS=" " read -r COMMIT_SHA COMMIT_MSG
|
||||
do
|
||||
echo "* [$COMMIT_SHA]($GITHUB_COMMIT_URL$COMMIT_SHA)" >> $OUTPUT
|
||||
echo "$COMMIT_MSG" >> $OUTPUT
|
||||
done < $GIT_OUTPUT_FILE
|
||||
rm -f $GIT_OUTPUT_FILE
|
||||
|
||||
cat $OUTPUT
|
Loading…
Reference in New Issue
Block a user