Update merge-main-into-prs.yml (#12921)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-04-14 06:30:37 -07:00 committed by GitHub
parent 6c8f693352
commit 51dc1af6e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,15 +44,15 @@ jobs:
for pr in open_pulls: for pr in open_pulls:
# Compare PR head with main to see if it's behind # Compare PR head with main to see if it's behind
comparison = repo.compare(pr.base.ref, pr.head.ref) # Ensure correct order of base and head try:
if comparison.behind_by > 0: comparison = repo.compare(pr.base.ref, pr.head.ref) # Ensure correct order of base and head
try: if comparison.behind_by > 0:
# Merge main into the PR branch # Merge main into the PR branch
success = pr.update_branch() success = pr.update_branch()
assert success, "Branch update failed" assert success, "Branch update failed"
print(f"Merged 'master' into PR #{pr.number} ({pr.head.ref}) successfully.") print(f"Merged 'master' into PR #{pr.number} ({pr.head.ref}) successfully.")
except Exception as e: except Exception as e:
print(f"Could not merge 'master' into PR #{pr.number} ({pr.head.ref}): {e}") print(f"Could not merge 'master' into PR #{pr.number} ({pr.head.ref}): {e}")
env: env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }} GITHUB_REPOSITORY: ${{ github.repository }}