-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automate creating PRs to push content updates for iamdeveloper.…
…com (#61)
- Loading branch information
1 parent
a4ffa74
commit 22a7282
Showing
4 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PR_TITLE="chore (automated): update blog posts" | ||
BRANCH_NAME="chore_automated_update_blog_posts_$(date +%s)" | ||
|
||
git branch $BRANCH_NAME | ||
git switch $BRANCH_NAME | ||
|
||
# There are potentially multiple files if the blog post has images. | ||
git add . | ||
|
||
# See if we have any changes. We should. | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
echo "Creating PR \"$PR_TITLE\" for branch $BRANCH_NAME" | ||
git commit -m "$PR_TITLE" | ||
git push origin $BRANCH_NAME | ||
gh pr create --title "$PR_TITLE" --body "This is an automated PR to update blog posts" | ||
gh pr merge --auto --delete-branch --squash "$BRANCH_NAME" | ||
else | ||
# Shouldn't end up here, but log that there was nothing to sync | ||
echo "Looks like there was nothing to update." | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PR_TITLE="chore (automated): update videos" | ||
BRANCH_NAME="chore_automated_update_videos_$(date +%s)" | ||
|
||
git branch $BRANCH_NAME | ||
git switch $BRANCH_NAME | ||
|
||
# This is the only file we want to commit | ||
git add src/pages/streaming.md | ||
|
||
# See if we have any changes. We should. | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
echo "Creating PR \"$PR_TITLE\" for branch $BRANCH_NAME" | ||
git commit -m "$PR_TITLE" | ||
git push origin $BRANCH_NAME | ||
gh pr create --title "$PR_TITLE" --body "This is an automated PR to update videos on the streaming page" | ||
gh pr merge --auto --delete-branch --squash "$BRANCH_NAME" | ||
else | ||
# Shouldn't end up here, but log that there was nothing to sync | ||
echo "Looks like there was nothing to update." | ||
fi |