From 0f7c8de21738be8ff730c60ced8c73b2828ec464 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 27 Feb 2025 16:32:25 -0800 Subject: [PATCH] Add back-port workflow using dotnet/arcade (#25106) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/backport.yml | 78 ++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/backport.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 0000000000..8c7fd22ccb --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,78 @@ +name: Backport PR to branch +on: + issue_comment: + types: [created] + schedule: + # once a day at 13:00 UTC to cleanup old runs + - cron: '0 13 * * *' + +permissions: + contents: write + issues: write + pull-requests: write + actions: write + +jobs: + label: + if: ${{ contains(github.event.comment.body, '/backport to') }} + runs-on: ubuntu-latest + steps: + - name: Add Label + uses: actions/github-script@v6 + with: + script: | + const comment = context.payload.comment.body; + const match = comment.match(/\/backport to release\/v(\d+\.\d+)$/); + if (match) { + const version = match[1]; + const label = `Backport-${version}.x-Consider`; + console.log(label); + + // Add the label to the issue + await github.rest.issues.addLabels({ + ...context.repo, + issue_number: context.issue.number, + labels: [label], + }); + } else { + throw new Error("No version found in comment. Expected: /backport to release/vN.N"); + } + backport: + if: ${{ contains(github.event.comment.body, '/backport to') || github.event_name == 'schedule' }} + # validates our branch format and that the issue is labeled before backport + needs: label + uses: dotnet/arcade/.github/workflows/backport-base.yml@main + with: + repository_owners: 'powershell,travisez13' + pr_description_template: | + Backport of #%source_pr_number% to %target_branch% + + + + /cc %cc_users% + + ## Customer Impact + + - [ ] Customer reported + - [ ] Found internally + + [Select one or both of the boxes. Describe how this issue impacts customers, citing the expected and actual behaviors and scope of the issue. If customer-reported, provide the issue number.] + + ## Regression + + - [ ] Yes + - [ ] No + + [If yes, specify when the regression was introduced. Provide the PR or commit if known.] + + ## Testing + + [How was the fix verified? How was the issue missed previously? What tests were added?] + + ## Risk + + [High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.] +