CSSS / csss-site-backend

CSSS Website Backend (2024 - Present)
4 stars 0 forks source link

Github API interface with csss-site-backend #48

Closed DerpyWasHere closed 3 months ago

DerpyWasHere commented 3 months ago

Closes #20. (Vibes)

The REST API provided by Github has constraints detailed here. Realistically the only constraint we care about is x-ratelimit-remaining which I've already added a check for. We should probably further discuss how to gracefully handle this as currently I raise an exception when we hit <50 remaining API calls. As noted in #20, all of these functions are handled asynchronously, so I chose to leave a healthy margin to avoid being rate limited.

I added the functionality requested, adding/removing from organizations, adding/removing from teams. This is implemented in a new github module.

For testing I've created a new CSSS-Test-Organization, we can talk about transferring ownership of that in person/over call.

Authorization here in the github module is token based and administrated through the fine grained personal access token system in Github. As such we can just store it as an environment variable GITHUB_TOKEN.

DerpyWasHere commented 3 months ago

Note that when generating organization invites, iirc we're restricted to 50/hr, so in some scenarios we may want to implement rate limiting on the secondary rate limit (which is described on the rate limit page above). We should be fine though as we're generating max 12 or so invites per term.

We might also want to implement functions to list current members, which will be super easy and can probably be pushed to a new issue.

DerpyWasHere commented 3 months ago

I'm testing this on a test organization CSSS-Test-Organization that I made. Albeit far from professional I've just been using a test python script.

https://github.com/CSSS-Test-Organization