Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

Question concerning usage of this app #43

Closed
gep13 opened this issue Apr 13, 2019 · 8 comments
Closed

Question concerning usage of this app #43

gep13 opened this issue Apr 13, 2019 · 8 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@gep13
Copy link

gep13 commented Apr 13, 2019

I was really excited when I found this app as I thought that it would be a perfect helper for the workflow that we employ on a number of repositories.

However, the first attempt at using it, didn't work as I would have expected:

cake-build/website#609 (comment)

However, I thought that the issue here was due to the fact that the PR was coming from the develop branch on the fork, rather than a branch on the fork. However, I have just tried again with a branch on a fork, and I got the same result:

cake-build/website#635 (comment)

Are my expectations of what this app can do wrong?

Normally, in this situation, the steps that I would follow manually would be:

git clone https://github.com/gep13/website.git
cd website
git remote add upstream  https://github.com/cake-build/website.git
git checkout eazfuscator
git fetch upstream
git rebase upstream/develop
git push -f

And I was hoping that this app would be able to help with this. Is my expectations incorrect?

@asbjornu
Copy link

I have the same expectations as @gep13. It would be awesome if autorebase could meet those expectations. 😄

@tibdex
Copy link
Owner

tibdex commented Apr 13, 2019

Hi, indeed I never tested the app on forks.

I will probably have to make some developments on the upstream libraries github-cherry-pick and github-rebase to make it work. Not sure yet if it will be a quick fix or not but I'm determined to support the fork use case.

@tibdex tibdex added the enhancement New feature or request label Apr 13, 2019
@tibdex tibdex self-assigned this Apr 13, 2019
@tibdex tibdex added the bug Something isn't working label Apr 13, 2019
@gep13
Copy link
Author

gep13 commented Apr 14, 2019

@tibdex woo hoo! Let us know if you need any beta testers. Happy to help out!

@tibdex
Copy link
Owner

tibdex commented Apr 20, 2019

So, I investigated a bit and I have bad news. When making the necessary changes to support fork-PRs where the HEAD branch is from another repo (one that forked the original one), the Autorebase GitHub App doesn't have permission to force-push on this HEAD branch. Even if the author of the PR checked the "Allow edits from maintainers" box. The error is:

{ HttpError: Resource not accessible by integration
    at response.text.then.message (/home/tibdex/autorebase/node_modules/@octokit/rest/node_modules/@octokit/request/lib/request.js:56:27)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'HttpError',
  status: 403,
  headers: { /* [REDACTED] */ },
  request:
   { method: 'PATCH',
     url:
      'https://api.github.com/repos/tibdest/github-apps-test/git/refs/heads/master',
     headers:
      { accept: 'application/vnd.github.v3+json',
        'user-agent': 'octokit.js/16.22.0 Node.js/10.13.0 (macOS Mojave; x64)',
        authorization: 'token [REDACTED]',
        'content-type': 'application/json; charset=utf-8' },
     body:
      '{"force":true,"sha":"51a378a1a094378768036501627f5268caddc796"}',
     request: { validate: [Object] } },
  documentation_url:
   'https://developer.github.com/v3/git/refs/#update-a-reference' }

The rejected request is this one.

Even if the owner of the fork were to install Autorebase on its repo, the GitHub App installation ID would be different so I'm quite sure it wouldn't help.

So I guess supporting fork-PRs cannot be done with the current design.
If you have any ideas to support it, I would be happy to hear them ;)

@gep13
Copy link
Author

gep13 commented Apr 20, 2019

@tibdex thank you for taking the time to investigate this!

To help me understand the infrastructure a little bit...

What is the difference between me as a user force pushing to the branch on the fork, which is allowed, and the autorebase app?

@tibdex
Copy link
Owner

tibdex commented May 2, 2019

What is the difference between me as a user force pushing to the branch on the fork, which is allowed, and the autorebase app?

I don't know precisely how GitHub handles permissions for the "Allow edits from maintainers" option but I guess it only works for real users (actual accounts) and not GitHub applications.

@gep13
Copy link
Author

gep13 commented May 2, 2019

@tibdex said..
I don't know precisely how GitHub handles permissions for the "Allow edits from maintainers" option but I guess it only works for real users (actual accounts) and not GitHub applications.

Yeah, that could well be it.

@thedrow
Copy link

thedrow commented Jun 10, 2019

If I provide you with an OAuth token to use I think that you will have permission to act on my behalf and rebase from a fork if "Allow edits from maintainers" is checked.
That requires creating an OAuth app instead of a Github app.

So when we register you'll need to get a token from the user using the web flow authentication and you'll be able to use that token to impersonate the user.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants