Skip to content

Conversation

@bluekeyes
Copy link
Owner

Add a new -fork flag to the CLI which will submit a pull request from a fork, creating it if it does not exist. This avoids needing write access on the target repository. Also add the -fork-repository flag, which sets a custom name and owner for the fork. The default is to create a fork with the same name as the target, owned by the current user.

Last, modify the error handler to print a hint on any 404 error that the problem might be due to permissions. It should maybe print the same message on 403 errors, but I haven't seen an example of that yet.

Closes #75.

@bluekeyes
Copy link
Owner Author

bluekeyes commented Jan 9, 2024

Notes from testing:

  • One minute is not long enough to wait for a fork; I had a very small but old repository take longer than that. Increase this, but also add some kind of progress message so users know what is happening
  • The minimum 5 second delay for forks is also kind of annoying, probably decrease this and add backoff after each poll instead of a fixed interval
  • Forking between two repositories in the same organization did not work, but it's unclear if this was something I did or a bug in GHES 3.8 that is fixed in newer versions or on GitHub.com. Creating the fork works and you can submit the PR in the UI, but trying to submit the PR with the API fails with a validation error on the head field.

Edit: With further testing, hitting the timeout seems to be an issue with the Git data API and organization forks: the fork exists and is ready, but getting the ref keeps returning 404. I switched to listing commits instead and that seems to bypass the problem.

@bluekeyes bluekeyes merged commit 8dac3b6 into master Jan 9, 2024
@bluekeyes bluekeyes deleted the forks branch January 9, 2024 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for forks in the CLI

2 participants