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

Feat: Private tasks list #24

Merged
merged 16 commits into from Mar 8, 2024
Merged

Conversation

devpanther
Copy link
Contributor

Resolves #2

  • Make sure the GitHub app is installed on the private repo

@0x4007
Copy link
Member

0x4007 commented Mar 5, 2024

I added it to devpool-directory-private

src/home/fetch-github/fetch-issues-preview.ts Outdated Show resolved Hide resolved
src/home/github-types.ts Show resolved Hide resolved
src/home/github-types.ts Outdated Show resolved Hide resolved
@0x4007
Copy link
Member

0x4007 commented Mar 5, 2024

Before addressing the tag comment make sure it displays the issues first

image

@devpanther
Copy link
Contributor Author

Before addressing the tag comment make sure it displays the issues first

image

It can't show issues right now, it'd have to fetch from my account as the main private in ubiquity isn't setup yet.. the APP_ID and APP PRIVATE KEY isn't visible on the private repo, it needs it on the repository level

@devpanther
Copy link
Contributor Author

Once that's done, it'd begin to fetch the private repos

@devpanther
Copy link
Contributor Author

Oops, this commit also contains the toggle in progress. and I do not know why the Cloudlfare deploy is failing

No logs @pavlovcik

@0x4007
Copy link
Member

0x4007 commented Mar 5, 2024

I think just display the issues without a switch or anything for testing?

@devpanther
Copy link
Contributor Author

I think just display the issues without a switch or anything for testing?

It displays by default, the ubiquity/devpool-directory-private has no issues yet, or should I use my repo for test and we'd change the variables before merge

@devpanther
Copy link
Contributor Author

The ubiquity private devpool isn't working yet because of the secrets issue. The app I'd and private key would need to be copied to the repo level

@devpanther
Copy link
Contributor Author

@pavlovcik can we move the secrets to devpool-private repo so we can test this out.. it needs the APP_ID, APP_SECRET on repo-level

@devpanther
Copy link
Contributor Author

For the TWITTER secrets, I'd use placeholders.. I cannot use mine as a test here because you don't have access to my private org

@devpanther
Copy link
Contributor Author

devpanther commented Mar 5, 2024

@devpanther
Copy link
Contributor Author

Screenshot 2024-03-05 at 6 51 37 PM

View when I use my personal repo in the variable for test

@0x4007
Copy link
Member

0x4007 commented Mar 6, 2024

Mine on the same code: https://github.com/devpanther/devpool-directory-private/issues (invited you) , the keys should be moved to the repo-level

I can take a look in a little bit.

@0x4007
Copy link
Member

0x4007 commented Mar 6, 2024

image

Its done

Nothing in the UI suggests that the org secrets won't work here, but give it a shot.

@devpanther devpanther changed the title Private tasks list Feat: Private tasks list Mar 6, 2024
@devpanther
Copy link
Contributor Author

@pavlovcik its ready for test, I tried to log in on the test URL provided by Cloudflare.. the GitHub callback redirected me to the main work URL

@0x4007
Copy link
Member

0x4007 commented Mar 6, 2024

@pavlovcik its ready for test, I tried to log in on the test URL provided by Cloudflare.. the GitHub callback redirected me to the main work URL

It doesn't work. You need to intercept the auth hash in the URL. Copy it then paste it into the continuous deploy link.

image

@devpanther
Copy link
Contributor Author

It doesn't work. You need to intercept the auth hash in the URL. Copy it then paste it into the continuous deploy link.

Okay, I'm working on deleting the cached tasks when you log in.. because the previous tasks are cached that is why you can't see privates

@rndquu
Copy link
Member

rndquu commented Mar 6, 2024

@devpanther How can I QA this PR?

  1. Run work.ubq.fi from this PR
  2. Authenticate with github
  3. Since I'm a member of the Ubiquity org I should see issues from https://github.com/ubiquity/devpool-directory-private/issues

Correct?

@rndquu rndquu self-requested a review March 6, 2024 12:53
@devpanther
Copy link
Contributor Author

Please help me resolve this @rndquu
I keep going back to GitHub to try and ease the transition but end up spending time on pulls

We need a dedicated QA engineer

I'm quite fit for the position

@devpanther
Copy link
Contributor Author

Correct?

We have somethings that needs to be done so we can QA.

The 0Auth Bot used for signin on work.ubq.fi needs to be added to the devpool-directory-private

@devpanther
Copy link
Contributor Author

And then the bot needs to be given the permissions i listed above, it needs members access on org-level and issues permission on repo-level.. that was it can check if a user is part of an org and get issues even when its private

@devpanther
Copy link
Contributor Author

@devpanther How can I QA this PR?

  1. Run work.ubq.fi from this PR
  2. Authenticate with github
  3. Since I'm a member of the Ubiquity org I should see issues from https://github.com/ubiquity/devpool-directory-private/issues

Correct?

Once we get that done, then the QA is pretty much straightforward like this

@devpanther
Copy link
Contributor Author

Screenshot 2024-03-06 at 1 59 15 PM

I have my 0Auth bot installed on https://github.com/ubiquity/devpool-directory-private right now, the official 0Auth should be installed there too after adding the permissions

@rndquu
Copy link
Member

rndquu commented Mar 7, 2024

@devpanther

The 0Auth Bot used for signin on work.ubq.fi needs to be added to the devpool-directory-private

You sure that OAuth apps can be added directly to repositories? I can't find such option in the settings:
Screenshot 2024-03-07 at 11 24 37

@devpanther
Copy link
Contributor Author

You sure that OAuth apps can be added directly to repositories? I can't find such option in the settings:

Oh, i see now, unfortunately, that won't work for this feature. its hit its limit with this one, why don't we make use of the official ubiquity bot for sign-ins too.

Or we can just change this OAuth Bot to a normal bot and install it on the devpool-private and that's it

@devpanther
Copy link
Contributor Author

@rndquu If it's going to be too tasking. I can create the bot, request for it to be added to the private repo and then transfer ownership.

The bot would be need to be added to supabase to replace the OAuth after that

@rndquu
Copy link
Member

rndquu commented Mar 7, 2024

@devpanther

I don't understand why we need to add additional github apps to read issues from private repos. From what I understand, if you are authenticated via github and your PAT has access for any private repo issues then you can use that PAT to read issues, right?

Right now when I'm authenticated via github I'm getting this error:
Screenshot 2024-03-07 at 13 02 39

I guess we should check that authenticated user is either a collaborator in a private repo either a member of an organization.

@devpanther
Copy link
Contributor Author

devpanther commented Mar 7, 2024

I guess we should check that authenticated user is either a collaborator in a private repo either a member of an organization.

You are getting that error because the OAuth can't even check if the user is part of the org because it does not have the scope to do that.

The error is from the octokit function checkCollaborator, it works on my own app and only when i add the bot to the private repo, so this OAuth doesn't stand a chance to read the private issues

@devpanther
Copy link
Contributor Author

if you are authenticated via github and your PAT has access for any private repo issues then you can use that PAT to read issues, right?

OAuth only have right to sign you in and read your profile, in this case we'd need a scope to specifically read repos and private repos.. supabase won't allow you set scopes so we have to use an app, not OAuth app

@devpanther
Copy link
Contributor Author

I'v tried to create an OAuth app too and trust me, it doesn't work

@rndquu
Copy link
Member

rndquu commented Mar 7, 2024

I'v tried to create an OAuth app too and trust me, it doesn't work

Did you try https://supabase.com/docs/reference/javascript/auth-signinwithoauth?example=sign-in-with-scopes ?

@devpanther
Copy link
Contributor Author

Screenshot 2024-03-07 at 11 36 11 AM

@rndquu That worked, this is what it showed afterwards.. i think the repo owners would have to approve the OAuth bot to access their private repos

Can you accept mine so i can test?

@devpanther
Copy link
Contributor Author

It should work now, you'd have to send a request with the OAuth app too and it should be able to access with this scope

Totally missed that doc, thank you

@devpanther
Copy link
Contributor Author

Btw, I see there is a PR to remove this Cypress run failing.. when'd it be merged, i don't like to see fails

@devpanther
Copy link
Contributor Author

@pavlovcik I think this is done, except the failing test

Copy link
Member

@0x4007 0x4007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using empty strings are a bad idea.

I tested and it works but please make these requested code adjustments.

src/home/fetch-github/fetch-and-display-previews.ts Outdated Show resolved Hide resolved
src/home/fetch-github/fetch-issues-preview.ts Outdated Show resolved Hide resolved
src/home/getters/get-github-access-token.ts Outdated Show resolved Hide resolved
src/home/github-types.ts Outdated Show resolved Hide resolved
@0x4007 0x4007 merged commit 04e1f25 into ubiquity:development Mar 8, 2024
2 checks passed
@ubiquibot ubiquibot bot mentioned this pull request Mar 8, 2024
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.

Internal Task Listing
3 participants