From 1f0078766d280df470f1001d17bcd8585940e9f5 Mon Sep 17 00:00:00 2001 From: Meliox <5264368+Meliox@users.noreply.github.com> Date: Thu, 11 Jun 2026 20:15:03 +0200 Subject: [PATCH] workflow: always rebase pr-test the lastest main (#200) * rebase the lastest main * s --------- Co-authored-by: Meliox --- .github/workflows/pr-create.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-create.yml b/.github/workflows/pr-create.yml index b10b27a..1abc5a9 100644 --- a/.github/workflows/pr-create.yml +++ b/.github/workflows/pr-create.yml @@ -45,10 +45,14 @@ jobs: git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - # Checkout existing bump branch or create it from main - git fetch origin chore/version-bump 2>/dev/null && \ - git checkout chore/version-bump || \ - git checkout -b chore/version-bump + # Always rebase the bump branch on the latest main so the PR is testable + git fetch origin main + if git fetch origin chore/version-bump 2>/dev/null; then + git checkout chore/version-bump + git rebase origin/main + else + git checkout -b chore/version-bump origin/main + fi # Append this merge's changes to the top of CHANGES.md mkdir -p .github/version-bump @@ -60,8 +64,11 @@ jobs: } > .github/version-bump/CHANGES.md git add .github/version-bump/CHANGES.md - git commit -m "chore: accumulate changes from $(git rev-parse --short HEAD~1)" - git push origin chore/version-bump + MAIN_SHA=$(git rev-parse --short origin/main) + git commit -m "chore: accumulate changes from ${MAIN_SHA}" + + # Rebase rewrites history, so the push must be a force (lease-guarded). + git push --force-with-lease origin chore/version-bump - name: Build PR body from accumulated changes run: | @@ -82,8 +89,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | BUMP_BRANCH="chore/version-bump" - VERSION=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/') - TITLE="chore: release next version (current: v${VERSION})" + TITLE="chore: release next version" EXISTING=$(gh pr list \ --head "$BUMP_BRANCH" \