-
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.
BREAKING CHANGE: Use body replacement instead of details/summary or H…
…TML comments (#11) * Use header/footer to update * move back env * Update action.yml * quote to keep newlines * Update action.yml * Update action.yml * Update README.md * Update action.yml
- Loading branch information
Showing
2 changed files
with
16 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,12 @@ runs: | |
using: composite | ||
steps: | ||
- shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
FROM_STEP: ${{ inputs.from_step }} | ||
TO_STEP: ${{ inputs.to_step }} | ||
BRANCH_NAME: ${{ inputs.branch_name }} | ||
BASE_BRANCH_NAME: ${{ inputs.base_branch_name }} | ||
run: | | ||
echo "Check that all required env variables are set" | ||
if [ -z "$TO_STEP" ] | ||
|
@@ -39,7 +45,7 @@ runs: | |
fi | ||
echo "Check that we are on FROM_STEP" | ||
if [ "$(cat .github/script/STEP)" != $FROM_STEP ] | ||
if [ "$(cat .github/steps/-step.txt)" != $FROM_STEP ] | ||
then | ||
echo "Current step is not $FROM_STEP" | ||
exit 0 | ||
|
@@ -48,28 +54,20 @@ runs: | |
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 | ||
echo "Add 'open' to step TO_STEP" | ||
sed -i.tmp -r "s/<details id=$TO_STEP>/<details id=$TO_STEP open>/g" README.md | ||
echo "Update all HTML comments to hide everything" | ||
sed -i.tmp -r 's/<!--step([0-9X]+)-->/<!--step\1/g' README.md | ||
sed -i.tmp -r 's/<!--endstep([0-9X]+)-->/endstep\1-->/g' README.md | ||
echo "Update the step to TO_STEP" | ||
NEXT_STEP=$(cat .github/steps/$TO_STEP-*.md) | ||
HEADER=$(awk '/<header>/,/<\/header>/' README.md) | ||
FOOTER=$(awk '/<footer>/,/<\/footer>/' README.md) | ||
echo -e "$HEADER\n\n$NEXT_STEP\n\n$FOOTER" > README.md | ||
echo "Show the current TO_STEP" | ||
sed -i.tmp -r "s/<\!--step$TO_STEP/<\!--step$TO_STEP-->/g" README.md | ||
sed -i.tmp -r "s/endstep$TO_STEP-->/<\!--endstep$TO_STEP-->/g" README.md | ||
echo "Update the STEP file to TO_STEP" | ||
echo "$TO_STEP" > .github/script/STEP | ||
echo "Update step file to TO_STEP" | ||
echo "$TO_STEP" > .github/steps/-step.txt | ||
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 | ||
git add .github/script/STEP | ||
git add .github/steps/-step.txt | ||
git commit --message="Update to $TO_STEP in STEP and README.md" | ||
git push | ||
|
@@ -82,9 +80,3 @@ runs: | |
else | ||
echo "Branch $BRANCH_NAME does not exist" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
FROM_STEP: ${{ inputs.from_step }} | ||
TO_STEP: ${{ inputs.to_step }} | ||
BRANCH_NAME: ${{ inputs.branch_name }} | ||
BASE_BRANCH_NAME: ${{ inputs.base_branch_name }} |