Skip to content

Conversation

@AlanCitrix
Copy link

Resolves #2503


Before the change?

  • The repository owner has to either be parsed out of the full_name, or passed around as a separate variable.

After the change?

  • Repository owner is now a computed field in both the repository resource and data source.
  • The data source can be queried by name + owner when using anonymous auth. full_name will also still work.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Jun 3, 2025
@github-actions github-actions bot added Type: Feature New feature or request Type: Documentation Improvements or additions to documentation labels Nov 10, 2025
@nickfloyd nickfloyd moved this from Backlog to In Review in Terraform Provider Nov 10, 2025
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

Just a comment about making things a little more safe.

d.Set("topics", flattenStringList(repo.Topics))
d.Set("node_id", repo.GetNodeID())
d.Set("repo_id", repo.GetID())
d.Set("owner", repo.GetOwner().GetLogin())
Copy link
Contributor

Choose a reason for hiding this comment

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

I belive this will panic if nil Recommend using go-github's safe accessor

Suggested change
d.Set("owner", repo.GetOwner().GetLogin())
if repo.Owner != nil {
d.Set("owner", repo.Owner.GetLogin())
}

Alternatively we could defensively:

if repo != nil && repo.Owner != nil {
    d.Set("owner", repo.Owner.GetLogin())
} else {
    d.Set("owner", "")
}

@github-project-automation github-project-automation bot moved this from 👀 In review to 🏗 In progress in 🧰 Octokit Active Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Documentation Improvements or additions to documentation Type: Feature New feature or request

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add owner attribute to github_repository data source and resource

2 participants