Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ def create_or_checkout_branch(repo, branch_name, base_branch):
print("Error checking out branch: {}".format(str(e)))
sys.exit(1)

# Delete the unused branch in the remote manifest repository
def delete_branch(repo, branch_name):
print("Delete unused branch: {}".format(branch_name))
print(':{}'.format(branch_name))
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The print(':{}'.format(branch_name)) line looks like leftover debug output and doesn’t add useful context (it duplicates what’s in the refspec). Consider removing it to keep action logs clean.

Suggested change
print(':{}'.format(branch_name))

Copilot uses AI. Check for mistakes.
try:
remote = repo.remote(name='origin')
remote.push(refspec=(':{}'.format(branch_name)))
except GitCommandError as e:
print("Error delete branch: {}".format(str(e)))
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "Error delete branch" is grammatically awkward and also omits which branch failed to delete. Consider rephrasing to "Error deleting branch <branch_name>" (and optionally include the remote) to make failures easier to diagnose from workflow logs.

Suggested change
print("Error delete branch: {}".format(str(e)))
print("Error deleting branch {}: {}".format(branch_name, str(e)))

Copilot uses AI. Check for mistakes.
sys.exit(1)

def main():
github_token = os.getenv('GITHUB_TOKEN')
manifest_repo_path = os.getenv('MANIFEST_REPO_PATH')
Expand Down Expand Up @@ -290,8 +301,12 @@ def main():

changes_made = update_xml_files(manifest_repo_path, updates)
if changes_made:
commit_and_push(manifest_repo_path, "Update manifest for {}".format(','.join(updates.keys())))
create_pull_request(github_token, manifest_repo_name, feature_branch, base_branch, manifest_pr_title, manifest_pr_description)
commit_and_push(manifest_repo_path, "Update manifest for {}".format(','.join(updates.keys())))
create_pull_request(github_token, manifest_repo_name, feature_branch, base_branch, manifest_pr_title, manifest_pr_description)
else:
# delete the unused feature branch
delete_branch(repo, feature_branch)


if __name__ == '__main__':
main()
Loading