Skip to content

Handle pagination when listing commits in github_repository_file#366

Merged
jcudit merged 1 commit intointegrations:masterfrom
shoekstra:repository_file__add_list_commit_pagination
Feb 27, 2020
Merged

Handle pagination when listing commits in github_repository_file#366
jcudit merged 1 commit intointegrations:masterfrom
shoekstra:repository_file__add_list_commit_pagination

Conversation

@shoekstra
Copy link
Contributor

Hey @jcudit, @kpfleming,

When using github_repository_file, the resource attempts to lookup the file's commit info which involves listing all commits in a branch and looping backwards until it finds a commit containing the file.

Alas I didn't cover pagination when listing these commits for a branch which will cause a problem when the file's commit was too far in the past, users would see something like this:

Error: Cannot find file .github/workflows/tfsec.yml in repo <org/repo>

This PR fixes this by adding missing support for pagination - couldn't write a test for this but have fixed the issue we found in one of our repos.

Original use-case/tests did not cover pagination when looking up the commit info for a while, this commit adds it.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
@ghost ghost added the size/XS label Feb 27, 2020
@jcudit jcudit merged commit 98f88de into integrations:master Feb 27, 2020
@shoekstra shoekstra deleted the repository_file__add_list_commit_pagination branch February 27, 2020 22:09
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
…dd_list_commit_pagination

Handle pagination when listing commits in github_repository_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants