Skip to content

Commit

Permalink
Merge before update to step 5 (#57)
Browse files Browse the repository at this point in the history
* Create a script to merge branches

Run the script to avoid conflicts

* Correct the script path

* Delete the instruction to resolve conflicts

Now the conflicts are avoided!
  • Loading branch information
sinsukehlab authored Jan 8, 2024
1 parent 0471289 commit 420fa7a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/script/merge-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Make sure this file is executable
# chmod +x .github/script/merge-branch.sh

# USAGE: This script is used to merge a branch into another branch

# BACKGROUND: This operation is required to avoid conflicts between branches.

# Setup commiter identity
git config user.name github-actions
git config user.email [email protected]

# Merge branch
echo "If branch $branch2 exists, merge branch origin $branch1 into branch $branch2"
if git show-ref --quiet refs/heads/$branch2
then
git checkout $branch2
git merge origin $branch1
git push origin $branch2
else
echo "Branch $branch2 does not exist"
fi
1 change: 0 additions & 1 deletion .github/steps/5-merge-your-pull-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ You can now [merge](https://docs.github.com/get-started/quickstart/github-glossa
### :keyboard: Activity: Merge your pull request

1. Go to the **Pull requests** tab.
1. Resolve any merge conflicts. <!-- TODO: figure out a better way to deal with the merge conflicts. -->
1. Click **Merge pull request**.
1. _Once you turn on branch protection, Actions can no longer push directly to the `main` branch. Make sure that you're on the `ci` branch in the page you're following instructions from._ Wait about 20 seconds and then refresh the page. [GitHub Actions](https://docs.github.com/actions) will automatically update to the next step.
5 changes: 5 additions & 0 deletions .github/workflows/4-add-branch-protections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ 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
run: ./.github/script/merge-branch.sh
env:
branch1: main
branch2: ci

This comment has been minimized.

Copy link
@sinsukehlab

sinsukehlab Jan 11, 2024

Author Contributor

I forgot the token.


# TODO: figure out a better way to deal with the merge conflict.
# In README.md, switch step 4 for step 5.
Expand Down

0 comments on commit 420fa7a

Please sign in to comment.