From cb070a58956c7e6f9356db4abab4766ee6e6bd16 Mon Sep 17 00:00:00 2001 From: Thomas Roos Date: Wed, 2 Oct 2024 05:24:22 +0000 Subject: [PATCH] gh workflows auto-backport, backport-based-on-label Remove backport-based-on-label. Make auto-backport to use backport-based-on-label multi commit mechanism. --- .../auto-approve-and-enable-auto-merge.yml | 14 ++++---- .github/workflows/auto-backport.yml | 36 ++++++++----------- .github/workflows/backport-based-on-label.yml | 25 ------------- 3 files changed, 21 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/backport-based-on-label.yml diff --git a/.github/workflows/auto-approve-and-enable-auto-merge.yml b/.github/workflows/auto-approve-and-enable-auto-merge.yml index 52d7fc50a..ad542e575 100644 --- a/.github/workflows/auto-approve-and-enable-auto-merge.yml +++ b/.github/workflows/auto-approve-and-enable-auto-merge.yml @@ -5,22 +5,22 @@ on: types: [review_requested] branches: - '*-next' - -jobs: + +jobs: auto-approve-and-merge: runs-on: ubuntu-latest - name: auto approve and enable auto-merge + name: auto approve and enable auto-merge steps: - name: Sleep for 5 min (give PR time to create labels) run: sleep 5m shell: bash - + - name: check label after delay uses: docker://agilepathway/pull-request-label-checker:latest with: - any_of: auto-integrate,version-upgrade + any_of: auto-backport repo_token: ${{ secrets.BOT2_CREDENTIAL }} - + - name: Auto approve uses: juliangruber/approve-pull-request-action@v2.0.1 with: @@ -33,5 +33,3 @@ jobs: token: ${{ secrets.BOT2_CREDENTIAL }} pull-request-number: ${{ github.event.pull_request.number }} merge-method: rebase - - diff --git a/.github/workflows/auto-backport.yml b/.github/workflows/auto-backport.yml index 27968b8d7..730902f6f 100644 --- a/.github/workflows/auto-backport.yml +++ b/.github/workflows/auto-backport.yml @@ -5,30 +5,24 @@ on: branches: - master-next types: ["closed"] - +permissions: + contents: write + pull-requests: write jobs: - cherry_pick: - strategy: - fail-fast: false - matrix: - branch: [kirkstone, scarthgap, styhead] + backport: + name: Backport pull request runs-on: ubuntu-22.04 - name: Cherry pick into release branches - if: | - (github.event.pull_request.merged == true ) && - (contains(github.event.pull_request.labels.*.name, 'version-upgrade') || contains(github.event.pull_request.labels.*.name, 'auto-backport')) + # Only run when pull request is merged and labeled 'backport' + if: (github.event.pull_request.merged == true ) && + (contains(github.event.pull_request.labels.*.name, 'version-upgrade') || contains(github.event.pull_request.labels.*.name, 'auto-backport')) steps: - - name: checkout current - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Cherry pick into ${{ matrix.branch }}-next - uses: carloscastrojumo/github-cherry-pick-action@v1.0.6 + - name: Create backport pull requests + uses: korthout/backport-action@v3.1.0 with: - branch: ${{ matrix.branch }}-next - labels: | - auto-created - backport - ${{ matrix.branch }} - auto-integrate - token: ${{ secrets.BOT_CREDENTIAL }} + target_branches: kirkstone-next scarthgap-next styhead-next + # copy all labels (backport labels are automatically skipped) + copy_labels_pattern: .+ + github_token: ${{ secrets.BOT_CREDENTIAL }} diff --git a/.github/workflows/backport-based-on-label.yml b/.github/workflows/backport-based-on-label.yml deleted file mode 100644 index 32bbbfeac..000000000 --- a/.github/workflows/backport-based-on-label.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Backport merged pull request (multiple commits possible) -on: - pull_request_target: - types: [closed] -permissions: - contents: write - pull-requests: write -jobs: - backport: - name: Backport pull request - runs-on: ubuntu-22.04 - # Only run when pull request is merged and labeled 'backport' - if: (github.event.pull_request.merged == true ) && - (contains(github.event.pull_request.labels.*.name, 'backport')) - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Create backport pull requests - uses: korthout/backport-action@v1.3.1 - with: - target_branches: kirkstone-next scarthgap-next styhead-next - # copy all labels (backport labels are automatically skipped) - copy_labels_pattern: .+ - github_token: ${{ secrets.BOT_CREDENTIAL }}