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

Update validate plugin entry to account for publishing on behalf of orgs #1376

Merged
merged 2 commits into from
Nov 28, 2022

Conversation

dvargas92495
Copy link
Contributor

This change should allow plugin authors to publish plugins on behalf of their GitHub organization

@lishid
Copy link
Collaborator

lishid commented Nov 28, 2022

Hmm according to the github docs, it seems to care whether the requester is the org member:
https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user

Seems like it returns 302 if the requester isn't and 204 if both the requester and the username passed in is a member. Does anyone know how octokit handles the differentiation between 302 and 204?

@dvargas92495
Copy link
Contributor Author

302s seem to just return the data, which aligns with the current then => true, catch => false logic

https://github.com/octokit/request.js/blob/master/src/fetch-wrapper.ts#L69-L118

@dvargas92495
Copy link
Contributor Author

dvargas92495 commented Nov 28, 2022

I just did

.checkMembershipForUser({
  org: "obsidian-community",
  username: "joethei",
})

and it actually returned a 204 locally, despite me not being in the obsidian-community org. In any case, I believe the Promise should resolve

I could also rebase this branch to the branch with my plugin PR to see if the action works as intended

@lishid
Copy link
Collaborator

lishid commented Nov 28, 2022

Ok! Let's merge and see. Thank you for the contribution ❤️

@lishid lishid merged commit a38ef62 into obsidianmd:master Nov 28, 2022
@dvargas92495 dvargas92495 deleted the ValidateOrgs branch November 28, 2022 22:15
@dvargas92495
Copy link
Contributor Author

Seems to have worked!

#1342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants