mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 00:54:19 +01:00
Check repository scope in merge pr script
This commit is contained in:
15
Makefile
15
Makefile
@@ -169,20 +169,21 @@ endif
|
||||
exit 1; \
|
||||
fi; \
|
||||
export GITHUB_REPOSITORY="$$REPO"; \
|
||||
echo "Detected repository: $$REPO"; \
|
||||
else \
|
||||
export GITHUB_REPOSITORY="$(GITHUB_REPOSITORY)"; \
|
||||
echo "Using provided repository: $(GITHUB_REPOSITORY)"; \
|
||||
fi; \
|
||||
echo "Repository: $$REPO"; \
|
||||
echo "Checking GitHub CLI authentication..."; \
|
||||
if ! gh auth status >/dev/null 2>&1; then \
|
||||
AUTH=$$(gh auth status); \
|
||||
if [ -z "$$AUTH" ]; then \
|
||||
echo "auth: $$AUTH"; \
|
||||
echo "GitHub CLI not authenticated. Starting login process..."; \
|
||||
gh auth login; \
|
||||
gh auth login --scopes repo,workflow; \
|
||||
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; \
|
||||
echo "Merging PR #$(PR)..."; \
|
||||
if [ "$(LOCAL)" = "1" ]; then \
|
||||
echo "merging PR #$(PR) locally"; \
|
||||
uv run scripts/merge-pr.py $(PR) --local; \
|
||||
|
||||
@@ -121,10 +121,6 @@ def merge_remote(pr_number: int, commit_message: str, commit_title: str):
|
||||
print(f"\nMerge commit message:\n{commit_message}")
|
||||
else:
|
||||
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)
|
||||
finally:
|
||||
# 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
|
||||
# Using -F with the full message (title + body)
|
||||
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:
|
||||
print(f"Error merging PR: {error}")
|
||||
# Try to go back to original branch
|
||||
|
||||
Reference in New Issue
Block a user