File tree 4 files changed +37
-1
lines changed 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ The script will also look for merged pull requests that have the labels
25
25
It will also search for pull requests that target release branches and remove
26
26
any ` backport/* ` labels from them.
27
27
28
+ It will also make sure any pull requests that have ` ## :warning: BREAKING ` in
29
+ their description have the ` kind/breaking ` label.
30
+
28
31
### Merge queue synchronization
29
32
30
33
The script will also look for pull requests that have the label
Original file line number Diff line number Diff line change @@ -81,6 +81,19 @@ export const fetchUnmergedClosedWithMilestone = async (
81
81
return json ;
82
82
} ;
83
83
84
+ // returns a list of breaking PRs that don't have the label kind/breaking
85
+ export const fetchBreakingWithoutLabel = async ( ) => {
86
+ const response = await fetch (
87
+ `${ GITHUB_API } /search/issues?q=` +
88
+ encodeURIComponent (
89
+ `is:pr "## :warning: BREAKING" -label:kind/breaking repo:go-gitea/gitea` ,
90
+ ) ,
91
+ { headers : HEADERS } ,
92
+ ) ;
93
+ const json = await response . json ( ) ;
94
+ return json ;
95
+ } ;
96
+
84
97
// update a given PR with the latest upstream changes by merging HEAD from
85
98
// the base branch into the pull request branch
86
99
export const updatePr = async ( prNumber : number ) : Promise < Response > => {
Original file line number Diff line number Diff line change 1
- import { fetchMergedWithLabel , fetchTargeting , removeLabel } from "./github.ts" ;
1
+ import {
2
+ addLabels ,
3
+ fetchBreakingWithoutLabel ,
4
+ fetchMergedWithLabel ,
5
+ fetchTargeting ,
6
+ removeLabel ,
7
+ } from "./github.ts" ;
2
8
import { fetchGiteaVersions } from "./giteaVersion.ts" ;
3
9
import { debounce } from "https://deno.land/[email protected] /async/mod.ts" ;
4
10
@@ -17,9 +23,18 @@ const maintain = async () => {
17
23
await Promise . all ( [
18
24
removeLabelsFromMergedPr ( labelsToRemoveAfterMerge ) ,
19
25
removeBackportLabelsFromPrsTargetingReleaseBranches ( ) ,
26
+ addKindBreakingToBreakingPrs ( ) ,
20
27
] ) ;
21
28
} ;
22
29
30
+ // add kind/breaking to all breaking PRs that don't have it
31
+ const addKindBreakingToBreakingPrs = async ( ) => {
32
+ const breakingPrs = await fetchBreakingWithoutLabel ( ) ;
33
+ return Promise . all ( breakingPrs . items . map ( async ( pr : { number : number } ) => {
34
+ await addLabels ( pr . number , [ "kind/breaking" ] ) ;
35
+ } ) ) ;
36
+ } ;
37
+
23
38
const removeLabelFromMergedPr = async (
24
39
pr : { title : string ; number : number } ,
25
40
label : string ,
Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ webhook.on(
46
46
} ,
47
47
) ;
48
48
49
+ // on pull request open, run the label maintenance
50
+ webhook . on ( "pull_request.opened" , ( ) => {
51
+ labels . run ( ) ;
52
+ } ) ;
53
+
49
54
// on pull request creation, we'll automatically set the milestone
50
55
// according to the target branch (if it's a release branch)
51
56
webhook . on ( "pull_request.opened" , ( { payload } ) => {
You can’t perform that action at this time.
0 commit comments