From cb893246c8ed6bc6b11059fce1995311ad18ca91 Mon Sep 17 00:00:00 2001 From: Shinsuke Higashiyama aka Cinzeng Zia <94058150+sinsukehlab@users.noreply.github.com> Date: Wed, 17 Jan 2024 02:04:03 +0900 Subject: [PATCH] [Hotfix] Correct the script (#60) * Correct the git merge command * Add GITHUB_TOKEN to env * Make the script executable * Delete the comment --- .github/script/merge-branch.sh | 6 +++--- .github/workflows/4-add-branch-protections.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 .github/script/merge-branch.sh diff --git a/.github/script/merge-branch.sh b/.github/script/merge-branch.sh old mode 100644 new mode 100755 index 7cbacfd..2b88555 --- a/.github/script/merge-branch.sh +++ b/.github/script/merge-branch.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Make sure this file is executable -# chmod +x .github/script/merge-branch.sh +# chmod a+x .github/script/merge-branch.sh # USAGE: This script is used to merge a branch into another branch @@ -11,11 +11,11 @@ git config user.name github-actions git config user.email github-actions@github.com # Merge branch -echo "If branch $branch2 exists, merge branch origin $branch1 into branch $branch2" +echo "If branch $branch2 exists, merge branch $branch1 into branch $branch2" if git show-ref --quiet refs/heads/$branch2 then git checkout $branch2 - git merge origin $branch1 + git merge $branch1 git push origin $branch2 else echo "Branch $branch2 does not exist" diff --git a/.github/workflows/4-add-branch-protections.yml b/.github/workflows/4-add-branch-protections.yml index d1839b6..94327bd 100644 --- a/.github/workflows/4-add-branch-protections.yml +++ b/.github/workflows/4-add-branch-protections.yml @@ -56,13 +56,13 @@ jobs: fetch-depth: 0 # Let's get all the branches. ref: ci # Important, as normally `branch_protection_rule` event won't grab other branches - - name: Merge changes from origin main into ci + - name: Merge changes from origin/main into ci run: ./.github/script/merge-branch.sh env: - branch1: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + branch1: origin/main branch2: ci - # TODO: figure out a better way to deal with the merge conflict. # In README.md, switch step 4 for step 5. - name: Update to step 5 uses: skills/action-update-step@v2