Skip to content

Conversation

@bjohansebas
Copy link
Contributor

Related #148

@bjohansebas bjohansebas marked this pull request as draft February 24, 2025 20:26
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = async (knex) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This table is being created with the response from https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members, I think it makes the most sense. I don't think we need all the user information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was brought from the schema provided by GitHub

Comment on lines 75 to 91
for await (const org of organizations) {
debug(`Fetching members for org (${org.login})`)
logger.info(`Fetching members for org (${org.login})`)
const members = await github.fetchOrgMembersByLogin(org.login)
debug(`Got ${members.length} members for org: ${org.login}`)
debug('Validating data')
validateGithubListOrgMembers(members)

// Upsert each member in parallel
for await (const member of members) {
debug(`Upserting member (${member.login})`)
const mappedData = github.mappers.user(member)
await upsertGithubMembers(mappedData)
}
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This process needs to be as synchronous as possible due to potential latency since there may be multiple users in different organizations, as is the case with Express. This could cause errors when inserting.
image

@bjohansebas
Copy link
Contributor Author

I think the best option would be to split this PR into two: one for GitHub users and another for roles. @UlisesGascon What do you think? The roles topic has quite a bit of logic since there are roles by teams and by repository, at least that's what I understood from the GitHub API.

@bjohansebas bjohansebas marked this pull request as ready for review February 26, 2025 01:11
@bjohansebas
Copy link
Contributor Author

Is there anything I can do to move this forward?

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.

1 participant