diff --git a/.github/script/update-step.sh b/.github/script/update-step.sh deleted file mode 100755 index db99b88..0000000 --- a/.github/script/update-step.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# Make sure this file is executable -# chmod a+x .github/script/update-step.sh - -echo "Check that we are on FROM_STEP" -if [ "$(cat .github/script/STEP)" != $FROM_STEP ] -then - echo "Current step is not $FROM_STEP" - exit 0 -fi - -echo "Make sure we are on the main branch" -git checkout main - -echo "Remove 'open' from any
tags" -sed -r 's/
/
/g' README.md > tmp -mv tmp README.md - -echo "Add 'open' to step TO_STEP" -sed -r "s/
/
/g" README.md > tmp -mv tmp README.md - -echo "Update the STEP file to TO_STEP" -echo "$TO_STEP" > .github/script/STEP - -echo "Commit the files, and push to main" -git config user.name github-actions -git config user.email github-actions@github.com -git add README.md -git add .github/script/STEP -git commit --message="Update to $TO_STEP in STEP and README.md" -git push - -echo "If BRANCH_NAME, update that branch as well" -if git show-ref --quiet refs/heads/$BRANCH_NAME -then - git checkout $BRANCH_NAME - git cherry-pick main - git push -else - echo "Branch $BRANCH_NAME does not exist" -fi diff --git a/.github/workflows/0-start.yml b/.github/workflows/0-start.yml index 43a5c1d..e41332d 100644 --- a/.github/workflows/0-start.yml +++ b/.github/workflows/0-start.yml @@ -25,7 +25,6 @@ jobs: # We will only run this action when: # 1. This repository isn't the template repository - # 2. The STEP is currently '0' (see update-step.sh) # Reference https://docs.github.com/en/actions/learn-github-actions/contexts # Reference https://docs.github.com/en/actions/learn-github-actions/expressions if: ${{ github.repository_owner != 'githublearn' }} @@ -86,9 +85,10 @@ jobs: # and open
# and set STEP to '1' - name: Update to step 1 - run: ./.github/script/update-step.sh + uses: githublearn/action-update-step@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }} FROM_STEP: 0 TO_STEP: 1 BRANCH_NAME: my-resume diff --git a/.github/workflows/1-resolve-a-merge-conflict.yml b/.github/workflows/1-resolve-a-merge-conflict.yml index ba0cfdb..bb3f676 100644 --- a/.github/workflows/1-resolve-a-merge-conflict.yml +++ b/.github/workflows/1-resolve-a-merge-conflict.yml @@ -24,7 +24,6 @@ jobs: # We will only run this action when: # 1. This repository isn't the template repository - # 2. The STEP is currently 1 (see update-step.sh) # Reference https://docs.github.com/en/actions/learn-github-actions/contexts # Reference https://docs.github.com/en/actions/learn-github-actions/expressions if: ${{ github.repository_owner != 'githublearn' }} @@ -70,9 +69,10 @@ jobs: # and open
# and set STEP to '2' - name: Update to step 2 - run: ./.github/script/update-step.sh + uses: githublearn/action-update-step@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }} FROM_STEP: 1 TO_STEP: 2 BRANCH_NAME: my-resume diff --git a/.github/workflows/2-create-your-own-conflict.yml b/.github/workflows/2-create-your-own-conflict.yml index d4c539e..f3de03c 100644 --- a/.github/workflows/2-create-your-own-conflict.yml +++ b/.github/workflows/2-create-your-own-conflict.yml @@ -25,7 +25,6 @@ jobs: # We will only run this action when: # 1. This repository isn't the template repository - # 2. The STEP is currently 2 (see update-step.sh) # Reference https://docs.github.com/en/actions/learn-github-actions/contexts # Reference https://docs.github.com/en/actions/learn-github-actions/expressions if: ${{ github.repository_owner != 'githublearn' }} @@ -45,9 +44,10 @@ jobs: # and open
# and set STEP to '3' - name: Update to step 3 - run: ./.github/script/update-step.sh + uses: githublearn/action-update-step@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }} FROM_STEP: 2 TO_STEP: 3 BRANCH_NAME: my-resume diff --git a/.github/workflows/3-merge-your-pull-request.yml b/.github/workflows/3-merge-your-pull-request.yml index 9da398a..8b7102d 100644 --- a/.github/workflows/3-merge-your-pull-request.yml +++ b/.github/workflows/3-merge-your-pull-request.yml @@ -23,7 +23,6 @@ jobs: # We will only run this action when: # 1. This repository isn't the template repository - # 2. The STEP is currently 3 (see update-step.sh) # Reference https://docs.github.com/en/actions/learn-github-actions/contexts # Reference https://docs.github.com/en/actions/learn-github-actions/expressions if: ${{ github.repository_owner != 'githublearn' }} @@ -42,9 +41,10 @@ jobs: # and open
# and set STEP to 'X' - name: Update to step X - run: ./.github/script/update-step.sh + uses: githublearn/action-update-step@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }} FROM_STEP: 3 TO_STEP: X BRANCH_NAME: my-resume