Skip to content

Commit 3baae85

Browse files
alan-agius4devversion
authored andcommitted
fix(github-actions): delete obsolete branches and close superseded PRs
When using the `create-pr-for-changes` workflow, old branches are not being deleted, and the content of superseded PRs remains open. This change ensures that: - Obsolete branches are deleted after PR creation. - Previously created PRs with outdated content are automatically closed. Example: angular/angular#61203
1 parent 030487a commit 3baae85

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

github-actions/create-pr-for-changes/lib/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ async function main(): Promise<void> {
129129
const {
130130
data: {items: supersededPrs},
131131
} = await git.github.search.issuesAndPullRequests({
132+
advanced_search: 'true',
132133
q: toGithubSearchQuery({
133134
repo: `${repo.owner}/${repo.name}`,
134135
type: 'pull-request',
@@ -276,6 +277,7 @@ async function cleanUpObsoleteBranches(
276277
const {
277278
data: {items: obsoletePrs},
278279
} = await git.github.search.issuesAndPullRequests({
280+
advanced_search: 'true',
279281
q: toGithubSearchQuery({
280282
repo: `${repo.owner}/${repo.name}`,
281283
type: 'pull-request',

github-actions/create-pr-for-changes/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47995,6 +47995,7 @@ async function main() {
4799547995
core.info(`No pre-existing PR found for branch '${branchName}'.`);
4799647996
}
4799747997
const { data: { items: supersededPrs } } = await git.github.search.issuesAndPullRequests({
47998+
advanced_search: "true",
4799847999
q: toGithubSearchQuery({
4799948000
repo: `${repo.owner}/${repo.name}`,
4800048001
type: "pull-request",
@@ -48073,6 +48074,7 @@ ${prBody}`;
4807348074
}
4807448075
async function cleanUpObsoleteBranches(git, repo, forkRepo, branchPrefix) {
4807548076
const { data: { items: obsoletePrs } } = await git.github.search.issuesAndPullRequests({
48077+
advanced_search: "true",
4807648078
q: toGithubSearchQuery({
4807748079
repo: `${repo.owner}/${repo.name}`,
4807848080
type: "pull-request",

0 commit comments

Comments
 (0)