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: query user command #1

Merged
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2f0040e
chore: setup wrangler
gentlementlegen May 20, 2024
3f1dd19
chore: removed unused code
gentlementlegen May 21, 2024
cdd285c
chore: cloudflare build
gentlementlegen May 21, 2024
cf8c61a
chore: cloudflare build
gentlementlegen May 21, 2024
db6fd26
chore: cloudflare action change
gentlementlegen May 21, 2024
8d60fea
chore: added error posting
gentlementlegen May 22, 2024
1f0c7ff
chore: wallet and access query
gentlementlegen May 22, 2024
bbe52ba
chore: proper formatting for comment
gentlementlegen May 22, 2024
59355b8
chore: removed log
gentlementlegen May 22, 2024
43355fd
chore: test for membership in org
gentlementlegen May 22, 2024
6dcbd2f
chore: fix cloudflare deploy
gentlementlegen May 22, 2024
412368b
chore: fix cloudflare deploy
gentlementlegen May 22, 2024
18f11cf
chore: fix cloudflare deploy
gentlementlegen May 22, 2024
18cca30
chore: fixed knip workflow
gentlementlegen May 22, 2024
c202a99
chore: fixed cloudflare workflow
gentlementlegen May 22, 2024
11fbf03
chore: fixed cloudflare workflow
gentlementlegen May 22, 2024
d98524c
chore: fixed cloudflare workflow
gentlementlegen May 22, 2024
9d6da48
chore: fixed cloudflare workflow
gentlementlegen May 22, 2024
27a210b
chore: renamed token env var
gentlementlegen May 22, 2024
14d2210
chore: added tests for run
gentlementlegen May 22, 2024
129aa44
chore: fix cspell
gentlementlegen May 22, 2024
cdf8449
chore: fix knip
gentlementlegen May 22, 2024
7f47965
chore: improved docs
gentlementlegen May 22, 2024
302ef17
chore: improved docs
gentlementlegen May 22, 2024
ceb9a68
chore: changed logger and rest repo target
gentlementlegen May 22, 2024
de36110
chore: only POST method are now valid
gentlementlegen May 23, 2024
50769c4
chore: added POST request example and docs
gentlementlegen May 24, 2024
178fad1
Merge branch 'refs/heads/meniole-development' into development
gentlementlegen May 24, 2024
062d04e
chore: error is posted to the issue if fatal
gentlementlegen May 26, 2024
5238fea
chore: remove type from README.md
gentlementlegen May 26, 2024
a40e83a
chore: added Supabase types
gentlementlegen May 26, 2024
50a43b7
chore: use authToken for Octokit auth
gentlementlegen May 26, 2024
1bce8f8
chore: check invoking user instead of comment
gentlementlegen May 26, 2024
a8ac10c
Merge pull request #1 from Meniole/development
gentlementlegen May 26, 2024
ab95ee1
Merge branch 'refs/heads/meniole-development' into meniole-main
gentlementlegen May 26, 2024
7e67ad7
chore: update deploy
gentlementlegen May 26, 2024
3d0b2b0
chore: cspell ignore conf files
gentlementlegen May 26, 2024
66f57c4
chore: fixed formatting
gentlementlegen May 26, 2024
35727b2
chore: improved formatting
gentlementlegen May 26, 2024
e7fcf11
chore: test log
gentlementlegen May 26, 2024
2d45a41
chore: test log
gentlementlegen May 26, 2024
8a47b36
chore: changed fatal error
gentlementlegen May 26, 2024
bb4f0b7
chore: test fix async
gentlementlegen May 26, 2024
1723430
chore: added db for knip
gentlementlegen May 26, 2024
cbff911
chore: display only labels for access
gentlementlegen May 27, 2024
745f445
chore: always use logger for logs
gentlementlegen May 28, 2024
6eff715
chore: removed unused UBIQUIBOT_TOKEN
gentlementlegen May 29, 2024
1b99593
chore: removed unused env loading
gentlementlegen May 29, 2024
083f06d
chore: removed unused dep dotenv
gentlementlegen May 30, 2024
a6921ae
chore: changed check for members to checkCollaborator
gentlementlegen May 30, 2024
566c04c
chore: log status
gentlementlegen May 30, 2024
595023a
chore: log status
gentlementlegen May 31, 2024
212e9c0
chore: removed org check
gentlementlegen May 31, 2024
2fc0a44
chore: add log
gentlementlegen May 31, 2024
fb895f4
chore: add log
gentlementlegen May 31, 2024
046fc63
chore: add try catch
gentlementlegen May 31, 2024
7f15df7
chore: add try catch
gentlementlegen May 31, 2024
0c58c30
chore: fix log
gentlementlegen May 31, 2024
74913e6
chore: removed debug
gentlementlegen May 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: changed check for members to checkCollaborator
  • Loading branch information
gentlementlegen committed May 30, 2024
commit a6921aef70ccb1d4a66b71b454f238d3bb4d5f59
10 changes: 4 additions & 6 deletions src/handlers/query-user.ts
Original file line number Diff line number Diff line change
@@ -5,15 +5,13 @@ async function checkUserAccess(context: Context, username: string) {
if (!payload.organization || !payload.comment.user?.name) {
throw new Error("Missing Organization / User from payload, cannot check for organization membership.");
}
const { status } = await octokit.orgs.checkMembershipForUser({
const { status } = await octokit.repos.checkCollaborator({
username: payload.comment.user.name,
org: payload.organization.login,
repo: payload.repository.name,
owner: payload.repository.owner.login,
});
// @ts-expect-error Somehow typing seems wrong but according to
// https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user--status-codes
// 204 means the user is part of the Organization
if (status !== 204) {
await context.logger.fatal(`User ${username} cannot request another user as it is not member of the organization.`);
await context.logger.fatal(`User ${payload.comment.user.name} cannot request user ${username} as it is not a collaborator.`);
return false;
}
return true;