From 522908083cada44a77e7046c6248a028614811cb Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Sat, 19 Oct 2024 12:15:16 +0200 Subject: [PATCH] ci: fix branch creation and mergify file (#4391) --- .github/Makefile | 27 +++++++++++++------------ .github/workflows/run-minor-release.yml | 3 +++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/Makefile b/.github/Makefile index a53bf68725..7aa3e03d15 100644 --- a/.github/Makefile +++ b/.github/Makefile @@ -38,23 +38,23 @@ create-next-release: prepare-next-release create-prs-next-release .PHONY: update-labels update-labels: echo ' - name: backport patches to $(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION) branch' >> ../.mergify.yml - echo ' conditions:' >> ../.mergify.yml - echo ' - merged' >> ../.mergify.yml - echo ' - base=main' >> ../.mergify.yml - echo ' - label=backport-$(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION)' >> .mergify.yml - echo ' actions:' >> ../.mergify.yml - echo ' backport:' >> ../.mergify.yml - echo ' assignees:' >> ../.mergify.yml - echo ' - "{{ author }}"' >> ../.mergify.yml - echo ' labels:' >> ../.mergify.yml - echo ' - "backport"' >> ../.mergify.yml - echo ' branches:' >> ../.mergify.yml - echo ' - "$(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION)"' >> ../.mergify.yml + echo ' conditions:' >> ../.mergify.yml + echo ' - merged' >> ../.mergify.yml + echo ' - label=backport-$(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION)' >> ../.mergify.yml + echo ' actions:' >> ../.mergify.yml + echo ' backport:' >> ../.mergify.yml + echo ' assignees:' >> ../.mergify.yml + echo ' - "{{ author }}"' >> ../.mergify.yml + echo ' labels:' >> ../.mergify.yml + echo ' - "backport"' >> ../.mergify.yml + echo ' branches:' >> ../.mergify.yml + echo ' - "$(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION)"' >> ../.mergify.yml echo ' title: "[{{ destination_branch }}](backport #{{ number }}) {{ title }}"' >> ../.mergify.yml ## @help:prepare-major-minor-release:Prepare a major/minor release by creating a new branch reference. .PHONY: prepare-major-minor-release prepare-major-minor-release: + git checkout 8.x git checkout -b $(RELEASE_BRANCH) ## @help:create-branch-major-minor-release:Pushes the changes on the project folder to the new RELEASE_BRANCH. @@ -68,6 +68,7 @@ create-branch-major-minor-release: ## @help:prepare-next-release:Prepare the original branch for the next release cycle. .PHONY: prepare-next-release prepare-next-release: + git checkout main git checkout -b $(BACKPORT_BRANCH_NAME) $(MAKE) update-labels $(MAKE) git-diff @@ -85,7 +86,7 @@ create-prs-next-release: gh pr create \ --title "backport: Add backport-$(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION) label" \ --body "Merge as soon as $(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION) branch was created." \ - --base 8.x \ + --base main \ --label 'Team:Automation' || echo "There are no changes" ## Diff output diff --git a/.github/workflows/run-minor-release.yml b/.github/workflows/run-minor-release.yml index 33e12ef0f8..4389dfb24e 100644 --- a/.github/workflows/run-minor-release.yml +++ b/.github/workflows/run-minor-release.yml @@ -18,6 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + # as long as we are using 8.x we need to fetch main and 8.x branches + fetch-depth: 0 - name: Set github config run: |