-
Notifications
You must be signed in to change notification settings - Fork 37
feat: add Twitter post notification on new blog article #54
Conversation
I forgot to mention, but this PR concerns issue #50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, i left some small comments for you !
find ./content/post -name '*.md' | sort | uniq > current_branch_files | ||
CURRENT_BRANCH_FILES=$(cat current_branch_files) | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
git stash && git checkout HEAD~ && git clean -fdx && \ | ||
find ./content/post -name '*.md' | sort | uniq > previous_branch_files | ||
PREVIOUS_BRANCH_FILES=$(cat previous_branch_files) | ||
echo "current_branch_files=$CURRENT_BRANCH_FILES" | ||
echo "=========================================" | ||
echo "previous_branch_files=$PREVIOUS_BRANCH_FILES" | ||
echo "++++++++++++++++++++++++++++++++++++++++++++" | ||
echo "$CURRENT_BRANCH_FILES" > current_branch_files | ||
|
||
set +e | ||
POTENTIAL_ARTICLES=$(diff current_branch_files previous_branch_files | grep "content" | sed 's/[<>] //g') | ||
set -e | ||
|
||
#Fail if there was no potential articles found | ||
test ! -z "$POTENTIAL_ARTICLES" | ||
echo "message<<EOF" >> $GITHUB_ENV | ||
echo "Checkout this article on our blog." >> $GITHUB_ENV | ||
for article in $POTENTIAL_ARTICLES; do | ||
echo "> https://blog.osscameroon.com$(echo $article | sed "s/\.md//g; s/^\.\/content//g")" >> $GITHUB_ENV | ||
done | ||
echo "EOF" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional suggestion:
I will suggest to add this inside a bash script following the example made on 'notify_on_pull_request', so that this file will doesn't get too fat ('blog-deploy/blog-deploy.sh')...
What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
Co-authored-by: darker <[email protected]>
@elhmn note to myself 👉 review this at some point |
I'm not exactly too sure about this commit, but could the maintainers test it please ?