Skip to content

Commit

Permalink
feat: configurable base branch name (#5)
Browse files Browse the repository at this point in the history
* feat: configurable base branch name

Accepts a new input, `base_branch_name`, to indicate the name of
the branch containing the README file to be updated. Default
`main`.

* Update action.yml

Co-authored-by: Kevin Heis <[email protected]>
  • Loading branch information
TheAlbertDev and heiskr authored Nov 28, 2022
1 parent 6444e3c commit 813162e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
required: true
branch_name:
description: "If the learner is working in a branch, add the branch name."
base_branch_name:
description: "Optional name of the base branch (default: main)."
required: false
default: "main"
runs:
using: composite
steps:
Expand Down Expand Up @@ -41,8 +45,8 @@ runs:
exit 0
fi
echo "Make sure we are on the main branch"
git checkout main
echo "Make sure we are on the base branch ($BASE_BRANCH_NAME)"
git checkout $BASE_BRANCH_NAME
echo "Remove 'open' from any <details> tags"
sed -i.tmp -r 's/<details id=([0-9X]+) open>/<details id=\1>/g' README.md
Expand All @@ -61,7 +65,7 @@ runs:
echo "Update the STEP file to TO_STEP"
echo "$TO_STEP" > .github/script/STEP
echo "Commit the files, and push to main"
echo "Commit the files, and push to base branch"
git config user.name github-actions
git config user.email [email protected]
git add README.md
Expand All @@ -73,7 +77,7 @@ runs:
if git show-ref --quiet refs/heads/$BRANCH_NAME
then
git checkout $BRANCH_NAME
git cherry-pick main
git cherry-pick $BASE_BRANCH_NAME
git push
else
echo "Branch $BRANCH_NAME does not exist"
Expand Down

0 comments on commit 813162e

Please sign in to comment.