Skip to content

fix(data_source_github_release_asset): Fix #2514 remove accept header…#3186

Open
felipebraga wants to merge 1 commit intointegrations:mainfrom
felipebraga:fix/github-release-asset
Open

fix(data_source_github_release_asset): Fix #2514 remove accept header…#3186
felipebraga wants to merge 1 commit intointegrations:mainfrom
felipebraga:fix/github-release-asset

Conversation

@felipebraga
Copy link

Resolves #2514 and #2513

Fixes #2514 remove accept header that's cause http error 406 Not Acceptable when trying to download the asset.

The new data source github_release_asset introduced in provider version 6.11, which adds the functionality to download the file asset, but it wasn't working due to the req.Header.Set("Accept", "application/octet-stream") which was causing the GitHub API to return a 406 Not Acceptable.


Before the change?

  • The data source github_release_asset returns 406 Not Acceptable when trying to download the asset.
  • Doc has a mismatch attribute for the data source

After the change?

  • The data source github_release_asset is able to download the specified asset.
  • Doc is updated

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

…ccept header that's cause http error 406 Not Acceptable when try to download the asset
@github-actions
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@github-actions github-actions bot added the Type: Bug Something isn't working as documented label Feb 12, 2026
@stevehipwell
Copy link
Collaborator

CC @mdb

@stevehipwell
Copy link
Collaborator

@felipebraga what are your thoughts on the other changes introduced in #2514 related to setting the header? I would think that they should also be reverted?

@mdb
Copy link
Contributor

mdb commented Feb 14, 2026

The new data source github_release_asset introduced in provider version 6.11, which adds the functionality to download the file asset, but it wasn't working due to the req.Header.Set("Accept", "application/octet-stream") which was causing the GitHub API to return a 406 Not Acceptable.

@felipebraga Are you able to provide a specific release asset example where this can be reproduced? You may be onto something, though acceptance tests seemingly continue to pass both with and without the header handling changes introduced in #2514. So, it'd be good to have a more clear sense of the 406's cause.

$ TF_ACC=1 go test -v ./... -run TestAccGithubReleaseAssetDataSource
?   	github.com/integrations/terraform-provider-github/v6	[no test files]
=== RUN   TestAccGithubReleaseAssetDataSource
=== RUN   TestAccGithubReleaseAssetDataSource/queries_and_downloads_specified_asset_ID
=== RUN   TestAccGithubReleaseAssetDataSource/queries_without_downloading_the_specified_asset_ID
--- PASS: TestAccGithubReleaseAssetDataSource (5.79s)
    --- PASS: TestAccGithubReleaseAssetDataSource/queries_and_downloads_specified_asset_ID (3.42s)
    --- PASS: TestAccGithubReleaseAssetDataSource/queries_without_downloading_the_specified_asset_ID (2.38s)
PASS
ok  	github.com/integrations/terraform-provider-github/v6/github	6.913s

(Also, given #2514 was originally opened in 2024, it's possible a subsequent upgrade to https://github.com/google/go-github has made the header handling intro'd by #2514 unnecessary altogether; I just want to be sure)

repository = "example-repository"
owner = "example-owner"
asset_id = 12345
download_file = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants