-
Notifications
You must be signed in to change notification settings - Fork 262
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
GitHub export: Create new commits in your fork when writing to the upstream repo isn't allowed #1392
Conversation
…stream repo isn't allowed When the GitHub export flow used a forked repository, it would still attempt to create a branch in the upstream repository. This resulted in the following cryptic error: > There was an unexpected error (Not Found), please try again. If the > problem persists, please report it at https://github.com/WordPress/ > wordpress-playground/issues. This PR ensures that branch is created in the push target ## Testing instructions 1. Import an `upsidedown` theme from https://github.com/Automattic/themes 2. Run `await playground.writeFile('/wordpress/wp-content/themes/upsidedown/test.txt', 'test');` in devtools 3. Try to export the changes as a PR, confirm a PR got created Closes #1367
@adamziel, when do you believe this is going to be fixed? I just tried, and it's still not working for me. |
@henriqueiamarino it was still deploying. It should be good now – would you confirm? Automattic/themes#7800 |
Yey! It worked well, thanks @adamziel — I just created the following PR: |
Thank you for reporting! There seems to be an issue in that CI flow, it detects way more changes than there are:
cc @vcanales – I think that was set up by you? Any change it compares the commit to its HEAD in the same repo, which is likely a stale fork with highly outdated |
@adamziel were you able to reproduce this with the themes repo? I'm puzzled about why I was not and would like to learn from this. |
@adamziel oops, I also meant to say: Thank you very much for fixing this. |
The octokit call I updated failed for me with a 403 error from GitHub. It said something like "your OAuth setup is correct, but the organization limited what OAuth apps can do". Perhaps you have more permissions in the Automattic org than I do and the API call worked for you? |
Actually, I'm having second thoughts about this PR. The export flow will now create a new branch based on the fork's trunk. The fork might be heavily outdated, though, in which case the PR would contain extra changes. I'm not sure why this didn't happen in my test PR. Either way, we should sync the upstream branch to the fork before creating the branch – there's some code to do that in this discussion. I'm worried that could be slow, but slow is better than broken. Edit: It didn't happen in my PR because the BASE of the Playground-created branch was an old commit that exists in the upstream repo and git is smart enough to know the delta between that BASE and the upstream BASE isn't a part of the PR. Still, sooner or later we'll get a PR that has conflicts the moment it's created so let's pull from upstream to the fork before creating the branch. |
Based on a brief test, I think that is probable.
That sounds good, even if it is slow. |
…stream repo isn't allowed (#1392) When the GitHub export flow used a forked repository, it would still attempt to create a branch in the upstream repository. This resulted in the following cryptic error: > There was an unexpected error (Not Found), please try again. If the > problem persists, please report it at https://github.com/WordPress/ > wordpress-playground/issues. This PR ensures that branch is created in the push target ## Testing instructions 1. Import an `upsidedown` theme from https://github.com/Automattic/themes 2. Run `await playground.writeFile('/wordpress/wp-content/themes/upsidedown/test.txt', 'test');` in devtools 3. Try to export the changes as a PR, confirm a PR got created Closes #1367
When the GitHub export flow used a forked repository, it would still attempt to create a branch in the upstream repository. This resulted in the following cryptic error:
This PR ensures that branch is created in the push target
Testing instructions
upsidedown
theme from https://github.com/Automattic/themesawait playground.writeFile('/wordpress/wp-content/themes/upsidedown/test.txt', 'test');
in devtoolsCloses #1367