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; \
|
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; \
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user