Skip to content

Conversation

@viks-confluent
Copy link

Description:

safe-settings use get-content api to fetch all the repo permission override files. That api has a limit of 1000 and our org had way > 1000 repo files in the admin repo. This has lead to incorrect repo permissions.

GitHub Api docs: https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content

Fix is to use the github tree api(https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree) to read all the repos directory content.

Description:

safe-settings use get-content api to fetch all the repo permission override files. That api has a limit of 1000 and our org had way > 1000 repo files in the admin repo.
This has lead to incorrect repo permissions.

GitHub Api docs: https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content

Fix is to use the github tree api(https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree) to read all the repos directory content.
@viks-confluent
Copy link
Author

@decyjphr Please take a look at this when you get some time. Thanks!

Copy link
Collaborator

@decyjphr decyjphr left a comment

Choose a reason for hiding this comment

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

@viks-confluent 👍🏾


// read the repo contents using tree
this.log.debug(`repos directory info ${JSON.stringify(repoDirInfo)}`)
const endpoint = `/repos/${this.repo.owner}/${repo.repo}/git/trees/${repoDirInfo.sha}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

One option would be to replace github.request with some syntactic sugar github.git.getTree({owner, repo, tree_sha}) https://octokit.github.io/rest.js/v18#git-get-tree

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.

3 participants