-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configurable base branch name (#5)
* 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
1 parent
6444e3c
commit 813162e
Showing
1 changed file
with
8 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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" | ||
|