From 0355f63a481b21c59faad11276f3801709f008aa Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 11 Apr 2024 10:15:38 +0200 Subject: [PATCH] [CI] backport upgrade to git-backporting@v4.8.0 * no-auto-squash: true so it DTRT for merged & squashed PRs * target-branch-pattern: replaces the ad-hoc logic to determine the target branch name It also now supports backporting to multiple branches. This is not going to be immediately useful but will greatly help in three months when there are two releases receiving backports. --- .forgejo/workflows/backport.yml | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/.forgejo/workflows/backport.yml b/.forgejo/workflows/backport.yml index da064feff3..8ec41cd7af 100644 --- a/.forgejo/workflows/backport.yml +++ b/.forgejo/workflows/backport.yml @@ -45,39 +45,12 @@ jobs: cat <<'EOF' ${{ toJSON(github) }} EOF - - name: Fetch labels - id: fetch-labels - shell: bash - run: | - set -x - echo "Labels retrieved below" - export DEBIAN_FRONTEND=noninteractive - apt-get update -qq - apt-get -q install -qq -y jq - filtered_labels=$(echo "$LABELS" | jq -c 'map(select(.name | startswith("backport/v")))') - echo "FILTERED_LABELS=${filtered_labels}" >> $GITHUB_ENV - env: - LABELS: ${{ toJSON(github.event.pull_request.labels) }} - - name: Extract targets - id: extract-targets - shell: bash - run: | - set -x - targets="$(echo $FILTERED_LABELS | jq -c '[.[] | .name | sub("backport/"; "")]')" - echo "targets=$(echo $targets)" >> $GITHUB_OUTPUT - - - name: Printing info - shell: bash - run: | - echo "targets: ${{ steps.extract-targets.outputs.targets }}" - echo "target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}" - echo "pull-request: ${{ github.event.pull_request.url }}" - - - uses: https://code.forgejo.org/forgejo/git-backporting@b2554a678d5ea2814f0df3abad2ac4fcdee2d81f + - uses: https://code.forgejo.org/actions/git-backporting@v4.8.0 with: - target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}/forgejo + target-branch-pattern: "^backport/(?(v.*))$" strategy: ort strategy-option: find-renames cherry-pick-options: -x auth: ${{ secrets.BACKPORT_TOKEN }} pull-request: ${{ github.event.pull_request.url }} + auto-no-squash: true