Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d698b3a

Browse files
[Github] Filter only origin branches in prune unused branches workflow
We should only have branches from the origin remote when actually running the workflow, but this makes the script easier to test locally where I have branches from several different remotes. Reviewers: Pull Request: llvm#178540
1 parent b79f5b5 commit d698b3a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/prune-unused-branches.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ def get_branches() -> list[str]:
1313
]
1414

1515
def branch_filter(branch_name):
16-
return "users/" in branch_name or "revert-" in branch_name
16+
user_or_revert = "users/" in branch_name or "revert-" in branch_name
17+
origin_branch = branch_name.startswith("remotes/origin/")
18+
return user_or_revert and origin_branch
1719

1820
filtered_branches = list(filter(branch_filter, branches))
1921
return [branch.replace("remotes/origin/", "") for branch in filtered_branches]

0 commit comments

Comments
 (0)