Check repository scope in merge pr script

This commit is contained in:
PThorpe92
2025-07-31 11:39:57 -04:00
parent ca383a3b88
commit 84900c4da2
2 changed files with 9 additions and 12 deletions

View File

@@ -169,20 +169,21 @@ endif
exit 1; \ exit 1; \
fi; \ fi; \
export GITHUB_REPOSITORY="$$REPO"; \ export GITHUB_REPOSITORY="$$REPO"; \
echo "Detected repository: $$REPO"; \
else \ else \
export GITHUB_REPOSITORY="$(GITHUB_REPOSITORY)"; \ export GITHUB_REPOSITORY="$(GITHUB_REPOSITORY)"; \
echo "Using provided repository: $(GITHUB_REPOSITORY)"; \
fi; \ fi; \
echo "Repository: $$REPO"; \ echo "Repository: $$REPO"; \
echo "Checking GitHub CLI authentication..."; \ AUTH=$$(gh auth status); \
if ! gh auth status >/dev/null 2>&1; then \ if [ -z "$$AUTH" ]; then \
echo "auth: $$AUTH"; \
echo "GitHub CLI not authenticated. Starting login process..."; \ echo "GitHub CLI not authenticated. Starting login process..."; \
gh auth login; \ gh auth login --scopes repo,workflow; \
else \ else \
echo "GitHub CLI is already authenticated"; \ if ! echo "$$AUTH" | grep -q "workflow"; then \
echo "Warning: 'workflow' scope not detected. You may need to re-authenticate if merging PRs with workflow changes."; \
echo "Run: gh auth refresh -s repo,workflow"; \
fi; \
fi; \ fi; \
echo "Merging PR #$(PR)..."; \
if [ "$(LOCAL)" = "1" ]; then \ if [ "$(LOCAL)" = "1" ]; then \
echo "merging PR #$(PR) locally"; \ echo "merging PR #$(PR) locally"; \
uv run scripts/merge-pr.py $(PR) --local; \ uv run scripts/merge-pr.py $(PR) --local; \

View File

@@ -121,10 +121,6 @@ def merge_remote(pr_number: int, commit_message: str, commit_title: str):
print(f"\nMerge commit message:\n{commit_message}") print(f"\nMerge commit message:\n{commit_message}")
else: else:
print(f"Error merging PR: {error}") print(f"Error merging PR: {error}")
status_output, _, _ = run_command("gh pr status --json number,mergeable,mergeStateStatus")
if status_output:
print("\nPR status information:")
print(status_output)
sys.exit(1) sys.exit(1)
finally: finally:
# Clean up the temporary file # Clean up the temporary file
@@ -157,7 +153,7 @@ def merge_local(pr_number: int, commit_message: str):
# Merge the PR branch with the custom message # Merge the PR branch with the custom message
# Using -F with the full message (title + body) # Using -F with the full message (title + body)
cmd = f"git merge --no-ff {pr_branch} -F {temp_file_path}" cmd = f"git merge --no-ff {pr_branch} -F {temp_file_path}"
output, error, returncode = run_command(cmd) _, error, returncode = run_command(cmd)
if returncode != 0: if returncode != 0:
print(f"Error merging PR: {error}") print(f"Error merging PR: {error}")
# Try to go back to original branch # Try to go back to original branch