Skip to content

Commit 28b89e4

Browse files
authored
Use arcade backport workflow (#8683)
1 parent 4ccaaf4 commit 28b89e4

File tree

3 files changed

+10
-272
lines changed

3 files changed

+10
-272
lines changed

.github/workflows/backport.yml

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,17 @@ name: Backport PR to branch
22
on:
33
issue_comment:
44
types: [created]
5+
schedule:
6+
# once a day at 13:00 UTC to cleanup old runs
7+
- cron: '0 13 * * *'
58

6-
permissions: {}
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
actions: write
714

815
jobs:
916
backport:
10-
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/backport to') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
11-
runs-on: ubuntu-24.04
12-
permissions:
13-
contents: write
14-
issues: write
15-
pull-requests: write
16-
17-
steps:
18-
- name: Extract backport target branch
19-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
20-
id: target-branch-extractor
21-
with:
22-
result-encoding: string
23-
script: |
24-
if (context.eventName !== "issue_comment") throw "Error: This action only works on issue_comment events.";
25-
26-
// extract the target branch name from the trigger phrase containing these characters: a-z, A-Z, digits, forward slash, dot, hyphen, underscore
27-
const regex = /\/backport to ([a-zA-Z\d\/\.\-\_]+)/;
28-
target_branch = regex.exec(context.payload.comment.body);
29-
if (target_branch == null) throw "Error: No backport branch found in the trigger phrase.";
30-
31-
return target_branch[1];
32-
- name: Post backport started comment to pull request
33-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
34-
with:
35-
script: |
36-
const backport_start_body = `Started backporting to ${{ steps.target-branch-extractor.outputs.result }}: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
37-
await github.rest.issues.createComment({
38-
issue_number: context.issue.number,
39-
owner: context.repo.owner,
40-
repo: context.repo.repo,
41-
body: backport_start_body
42-
});
43-
- name: Checkout repo
44-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
45-
with:
46-
persist-credentials: true # We need to persist credentials to push the resulting changes upstream.
47-
fetch-depth: 0
48-
- name: Run backport
49-
uses: ./eng/actions/backport
50-
with:
51-
target_branch: ${{ steps.target-branch-extractor.outputs.result }}
52-
auth_token: ${{ secrets.GITHUB_TOKEN }}
53-
exclude: 'documentation/**.md'
54-
label: backport
17+
if: ${{ contains(github.event.comment.body, '/backport to') || github.event_name == 'schedule' }}
18+
uses: dotnet/arcade/.github/workflows/backport-base.yml@main

eng/actions/backport/action.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

eng/actions/backport/index.js

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)