Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/branch-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
run: |
if [[ -n "$RUNNER_DEBUG" ]]; then set -x; fi

current_branch="$(git rev-parse HEAD --abbrev-ref)"
current_branch="$(git branch --show-current)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing something, or changing to taste?

I'm not sure this as flexible is all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this was not giving the branch name, but the commit hash (even though a branch should definitely be checked out).


if git merge "origin/${HEAD_BRANCH}" --ff-only; then
if [[ "$(git rev-parse HEAD)" == "$(git rev-parse "origin/${current_branch}")" ]]; then
Expand Down Expand Up @@ -133,7 +133,9 @@ jobs:
id: push
if: steps.merge.outputs.continue
run: |
git switch -c "$SYNC_BRANCH" "origin/${HEAD_BRANCH}"
if [[ -n "$RUNNER_DEBUG" ]]; then set -x; fi

git switch "$SYNC_BRANCH"
git push origin "$SYNC_BRANCH"
echo "continue=true" >> $GITHUB_OUTPUT

Expand All @@ -152,7 +154,7 @@ jobs:
Triggered by `${{ github.event_name }}`
run: |
url="$(
gh pr create --head "$SYNC_BRANCH" \
gh pr create --head "$SYNC_BRANCH" --base "$BASE_BRANCH" \
--title "🤖 Merge ${SYNC_BRANCH} into ${BASE_BRANCH}" \
--body "$BODY"
)"
Expand Down
3 changes: 1 addition & 2 deletions configure-git/configure-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@

git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config push.default current || true # won't work if cwd is not git repo

git config --global push.default current
git config --global advice.diverging false