Skip to content

Commit f84f62e

Browse files
erikayasudachojomok
authored andcommitted
chore: auto opt in all PRs to backport to 2.21 (#12967)
Quick GitHub workflow to always label PRs with `backport 2.21` so backporting to the 2.21 branch is an opt OUT, not an opt IN. This should help prevent critical backports from being missed in the 2.21 branch. It will only skip PRs that are already backports, but by depending on the PR title. Tested with this PR. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent be36a84 commit f84f62e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Diff for: .github/workflows/add-2x-backport-tag.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Add 2.21 backport tag
2+
on:
3+
pull_request:
4+
types: [opened, reopened]
5+
6+
jobs:
7+
add-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: Add Label
13+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
14+
with:
15+
script: |
16+
const prTitle = context.payload.pull_request.title;
17+
const pattern = /^(ci:|fix:|fix\(|chore\(ci\)|fix\(ci\))/i;
18+
if (!prTitle.includes("[backport ") && pattern.test(prTitle)) {
19+
github.rest.issues.addLabels({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
issue_number: context.payload.pull_request.number,
23+
labels: ["backport 2.21"]
24+
});
25+
console.log("Label added.");
26+
} else {
27+
console.log("Skipping label: PR does not meet conditions.");
28+
}

0 commit comments

Comments
 (0)