Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In case a GitHub repository has been renamed, all but first non-GET requests should be be directed towards the renamed repo #1211

Open
PawelLipski opened this issue Mar 28, 2024 · 0 comments
Labels
github Relates to integration with GitHub gitlab Relates to integration with GitLab minor An annoyance, but not serious performance Something works too slow

Comments

@PawelLipski
Copy link
Collaborator

PawelLipski commented Mar 28, 2024

I've renamed a sandbox repo PawelLipski/mergify-sandbox to PawelLipski/mergify-sandbox-1, while leaving the old name in git remote:

$ git remote -v
origin	git@github.com:PawelLipski/mergify-sandbox.git (fetch)
origin	git@github.com:PawelLipski/mergify-sandbox.git (push)

Now when I run git machete github create-pr --debug:

Creating a PR from drop-constraint to call-ws... __fire_github_api_request(method=POST, path=/repos/PawelLipski/mergify-sandbox/pulls, request_body={'head': 'drop-constraint', 'base': 'call-ws', 'title': 'Drop unneeded SQL constraints', 'body': '', 'draft': 'False'}): firing a POST request to https://api.github.com/repos/PawelLipski/mergify-sandbox/pulls with a bearer token and request body {'head': 'drop-constraint', 'base': 'call-ws', 'title': 'Drop unneeded SQL constraints', 'body': '', 'draft': 'False'}
__fire_github_api_request(method=GET, path=/repositories/437973164, request_body=None): firing a GET request to https://api.github.com/repositories/437973164 with a bearer token and request body <none>
__fire_github_api_request(method=POST, path=/repositories/437973164/pulls, request_body={'head': 'drop-constraint', 'base': 'call-ws', 'title': 'Drop unneeded SQL constraints', 'body': '', 'draft': 'False'}): firing a POST request to https://api.github.com/repositories/437973164/pulls with a bearer token and request body {'head': 'drop-constraint', 'base': 'call-ws', 'title': 'Drop unneeded SQL constraints', 'body': '', 'draft': 'False'}
Warn: GitHub API returned 307 HTTP status with error message: Temporary Redirect.
It looks like the organization or repository name got changed recently and is outdated.
New organization is PawelLipski and new repository is mergify-sandbox-1.
You can update your remote repository via: git remote set-url <remote_name> <new_repository_url>.
OK, see https://github.com/PawelLipski/mergify-sandbox-1/pull/36
__fire_github_api_request(method=GET, path=/repos/PawelLipski/mergify-sandbox/pulls?head=PawelLipski:call-ws, request_body=None): firing a GET request to https://api.github.com/repos/PawelLipski/mergify-sandbox/pulls?head=PawelLipski:call-ws with a bearer token and request body <none>
Checking for open GitHub PRs (to determine PR chain)... __fire_github_api_request(method=GET, path=/repos/PawelLipski/mergify-sandbox/pulls?per_page=100, request_body=None): firing a GET request to https://api.github.com/repos/PawelLipski/mergify-sandbox/pulls?per_page=100 with a bearer token and request body <none>
OK
Updating description of PR #36 to include the chain of PRs... __fire_github_api_request(method=PATCH, path=/repos/PawelLipski/mergify-sandbox/pulls/36, request_body={'body': '<!-- start git-machete generated -->\n\n# Based on PR #32\n\n## Full chain of PRs as of 2024-03-28\n\n* PR #36: `drop-constraint` ➔ `call-ws`\n* PR #32: `call-ws` ➔ `build-chain`\n* PR #30: `build-chain` ➔ `allow-ownership-link`\n* PR #27: `allow-ownership-link` ➔ `develop`\n\n<!-- end git-machete generated -->\n'}): firing a PATCH request to https://api.github.com/repos/PawelLipski/mergify-sandbox/pulls/36 with a bearer token and request body {'body': '<!-- start git-machete generated -->\n\n# Based on PR #32\n\n## Full chain of PRs as of 2024-03-28\n\n* PR #36: `drop-constraint` ➔ `call-ws`\n* PR #32: `call-ws` ➔ `build-chain`\n* PR #30: `build-chain` ➔ `allow-ownership-link`\n* PR #27: `allow-ownership-link` ➔ `develop`\n\n<!-- end git-machete generated -->\n'}
__fire_github_api_request(method=PATCH, path=/repositories/437973164/pulls/36, request_body={'body': '<!-- start git-machete generated -->\n\n# Based on PR #32\n\n## Full chain of PRs as of 2024-03-28\n\n* PR #36: `drop-constraint` ➔ `call-ws`\n* PR #32: `call-ws` ➔ `build-chain`\n* PR #30: `build-chain` ➔ `allow-ownership-link`\n* PR #27: `allow-ownership-link` ➔ `develop`\n\n<!-- end git-machete generated -->\n'}): firing a PATCH request to https://api.github.com/repositories/437973164/pulls/36 with a bearer token and request body {'body': '<!-- start git-machete generated -->\n\n# Based on PR #32\n\n## Full chain of PRs as of 2024-03-28\n\n* PR #36: `drop-constraint` ➔ `call-ws`\n* PR #32: `call-ws` ➔ `build-chain`\n* PR #30: `build-chain` ➔ `allow-ownership-link`\n* PR #27: `allow-ownership-link` ➔ `develop`\n\n<!-- end git-machete generated -->\n'}
OK
Adding PawelLipski as assignee to PR #36... __fire_github_api_request(method=POST, path=/repos/PawelLipski/mergify-sandbox/issues/36/assignees, request_body={'assignees': "['PawelLipski']"}): firing a POST request to https://api.github.com/repos/PawelLipski/mergify-sandbox/issues/36/assignees with a bearer token and request body {'assignees': "['PawelLipski']"}
__fire_github_api_request(method=POST, path=/repositories/437973164/issues/36/assignees, request_body={'assignees': "['PawelLipski']"}): firing a POST request to https://api.github.com/repositories/437973164/issues/36/assignees with a bearer token and request body {'assignees': "['PawelLipski']"}
OK

After PR #1189 , the result of GET https://api.github.com/repositories/437973164 is cached by git_machete.code_hosting.CodeHostingClient.get_org_repo_and_git_url_by_repo_id_or_none... but still, every POST/PATCH to https://api.github.com/repos/PawelLipski/mergify-sandbox/.... results in a 307 redirect. It should be enough to only use the original PawelLipski/mergify-sandbox org/repo just once, and then use the new org/repo name (or just repo id) every time.

@PawelLipski PawelLipski added performance Something works too slow github Relates to integration with GitHub gitlab Relates to integration with GitLab minor An annoyance, but not serious labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github Relates to integration with GitHub gitlab Relates to integration with GitLab minor An annoyance, but not serious performance Something works too slow
Projects
None yet
Development

No branches or pull requests

1 participant