Skip to content

Commit

Permalink
Merge pull request #539 from spyrkob/issue_536
Browse files Browse the repository at this point in the history
[#536] update_post action - use the commit message to create PR title
  • Loading branch information
bstansberry authored Feb 29, 2024
2 parents 893516f + ed24aad commit b913635
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/update_post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,18 @@ jobs:
readonly COMMIT_EMAIL="[email protected]"
FIX_BRANCH_NAME=''
PR_TITLE=""
SOURCE_LINK=""
if [ "${ORIGINAL_PR}" != '' ]; then
echo "Checking out PR${ORIGINAL_PR}"
gh pr checkout "${ORIGINAL_PR}" --repo "${REPO_ID}"
FIX_BRANCH_NAME="fix_pr_${ORIGINAL_PR}"
SOURCE_LINK="[PR${ORIGINAL_PR}]($(gh browse ${ORIGINAL_PR} --repo "${REPO_ID}" -n))"
PR_TITLE="Update date of PR: $(gh pr view 1 --repo "${REPO_ID}" --json title --jq '.title')"
else
echo "Using branch main"
FIX_BRANCH_NAME="fix_pr_main"
SOURCE_LINK="[main]($(gh browse -b main -n --repo "${REPO_ID}"))"
PR_TITLE="Update date of post: ${OLD_POST}"
fi
if [ ! -f "_posts/${OLD_POST}" ]; then
Expand All @@ -72,9 +69,10 @@ jobs:
git config --global user.name "${COMMIT_USERNAME}"
git config --global user.email "${COMMIT_EMAIL}"
git commit -am "Update ${OLD_POST} blog date"
readonly COMMIT_MESSAGE="Update ${OLD_POST} blog date"
git commit -am "${COMMIT_MESSAGE}"
git push --set-upstream origin "${FIX_BRANCH_NAME}"
gh pr create --title "${PR_TITLE}"\
gh pr create --title "${COMMIT_MESSAGE}"\
--body "Date update for ${OLD_POST} from ${SOURCE_LINK}"\
--repo "${REPO_ID}"

0 comments on commit b913635

Please sign in to comment.