Skip to content

Backport PR to branch #358

Backport PR to branch

Backport PR to branch #358

Workflow file for this run

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%
<!--
DO NOT MODIFY THIS COMMENT. IT IS AUTO-GENERATED.
$$$originalpr:%source_pr_number%$$$
-->
/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.]