From 813162e446f203edd98f7cc7d39ce66bc191a71e Mon Sep 17 00:00:00 2001 From: Albert <83247762+TheAlbertDev@users.noreply.github.com> Date: Mon, 28 Nov 2022 20:50:28 +0100 Subject: [PATCH] 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 --- action.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 61b4add..ee29503 100644 --- a/action.yml +++ b/action.yml @@ -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
tags" sed -i.tmp -r 's/
/
/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 github-actions@github.com 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"