Skip to content

[BUG]: Pagination issue in github_repository_file data block #2005

Closed
@cavila-evoliq

Description

@cavila-evoliq

Expected Behavior

When the provider fails to find the file being looked for in the data block, if it does not exist in the first page, it should proceed to the second page.

Actual Behavior

Provider reported the file as not found.

Terraform Version

Terraform v1.6.0
on linux_amd64
integrations/github v5.41.0

Affected Resource(s)

  • data.github_repository_file

Terraform Configuration Files

data "github_repository_file" "lookup_files" {
  repository = "<some repo>"
  branch     = "<some branch>"
  file       = "<some file>"
}

provider "github" {
  token = "<some token>"
  owner = "<some owner>"
}

Steps to Reproduce

  1. Create a commit with 300+ changes.
  2. use data.github_repository_file to lookup a file that shows up on the 2nd page when you query the api.

Debug Output

Obviously wont post the full unredacted log but here's some snippets.

======Request for the commit======
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: -----------------------------------------------------
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: 2023/11/06 14:02:08 [DEBUG] GitHub API Request Details:
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: ---[ REQUEST ]---------------------------------------
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: GET /repos/redacted/redacted/commits/redacted HTTP/1.1
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: Host: api.github.com
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: User-Agent: go-github/v55.0.0
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: Accept: application/vnd.github.v3+json,application/vnd.github.stone-crop-preview+json
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: X-Github-Api-Version: 2022-11-28
2023-11-06T14:02:08.246-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: Accept-Encoding: gzip

=======Failed to find SHA======
2023-11-06T14:02:08.603-0600 [DEBUG] provider.terraform-provider-github_v5.41.0: 2023/11/06 14:02:08 [DEBUG] Found file: <redacted>/<redacted>/path/to/<redacted>, in commit SHA:  <blank>

Panic Output

No panic, just returns with error.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions