--- title: "ADR 0017: GitHub API limits and quirks the provider works around" --- * Status: accepted * Code: [`pkg/provider/github/github.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/provider/github/github.go) ## Context Several provider behaviours exist because of GitHub API limits, rate limiting or how the API treats identities. ## Decision * `maxCommentPages` caps comment pagination at 10 pages of 100 (`defaultPaginedNumber`), so up to 1000 comments are scanned. This allows legitimate use and prevents rate-limit exhaustion by comment flooding. * `GetTektonDir` reads the `.tekton` tree recursively through the Git tree API, which truncates at 500 entries. Larger trees are not fully read. * `GenerateJWT` sets a 5 minute expiry. GitHub's maximum is 10 minutes and the shorter value is a safety margin. * `GetCommitInfo` accepts a branch name as the ref when the event has no SHA (incoming webhooks), because GitHub resolves branches there. For incoming events it also fetches the repository default branch, since there is no payload to take it from and `pipelinerun_provenance: default_branch` needs it. * Comment updates only touch comments whose author is the PAC login (app slug for Apps, authenticated user for PATs), so comments from other users or bots are never edited. * `GetCommitInfo` reuses the commit cached by the commit comment handler to save one API call. * The commit comment path lists repositories through `cs.ListRepositories`, which uses the cached lister when configured, matching `matcher.MatchEventURLRepo`. ## Consequences * More than 1000 comments, or a `.tekton` tree over 500 entries, silently degrades behaviour. * Raising the JWT lifetime past 10 minutes makes GitHub reject it.