Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify GetBranch to handle redirects #1901

Merged
merged 4 commits into from
Jul 8, 2021

Conversation

n1lesh
Copy link
Contributor

@n1lesh n1lesh commented Jun 18, 2021

Adds a new followRedirects param for handling redirects on the GetBranch API. If redirected, the response.Request.URL will contain the redirected URL.

As per: #1895.

@google-cla google-cla bot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Jun 18, 2021
@codecov
Copy link

codecov bot commented Jun 18, 2021

Codecov Report

Merging #1901 (1972f5e) into master (75644ea) will increase coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1901      +/-   ##
==========================================
+ Coverage   97.65%   97.83%   +0.18%     
==========================================
  Files         105      105              
  Lines        6786     6803      +17     
==========================================
+ Hits         6627     6656      +29     
+ Misses         86       80       -6     
+ Partials       73       67       -6     
Impacted Files Coverage Δ
github/repos.go 98.75% <100.00%> (+0.04%) ⬆️
github/repos_contents.go 89.68% <0.00%> (+3.17%) ⬆️
github/actions_artifacts.go 100.00% <0.00%> (+6.45%) ⬆️
github/actions_workflow_jobs.go 100.00% <0.00%> (+8.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75644ea...1972f5e. Read the comment docs.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Please add the missing line and also add a test that runs through the code with a redirect.

See https://github.com/google/go-github/blob/master/github/repos_contents_test.go#L668-L693 for inspiration.

github/repos.go Show resolved Hide resolved
github/repos.go Show resolved Hide resolved
github/repos.go Show resolved Hide resolved
github/repos.go Show resolved Hide resolved
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Very nice, @n1lesh ! Thank you!
LGTM.

Awaiting second LGTM before merging.

@gmlewis gmlewis added the Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). label Jul 7, 2021
@gmlewis gmlewis requested a review from wesleimp July 7, 2021 20:17
Copy link

@Parker77 Parker77 left a comment

Choose a reason for hiding this comment

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

LGTM.

@gmlewis gmlewis merged commit c9fec82 into google:master Jul 8, 2021
@n1lesh n1lesh deleted the get-branch-redirect branch July 8, 2021 19:49
@n1lesh n1lesh restored the get-branch-redirect branch July 8, 2021 19:49
xun-guo-anzx added a commit to xun-guo-anzx/terraform-provider-github that referenced this pull request Aug 18, 2021
go-github released the Go client library to [38.1.0][1] recently.

API changes includes:
* Add ListOptions required by GetCommit method. As described in change[2]
* Add followRedirects required by GetBranch method and set it to false as start point. As described in change[3]

[1]: https://github.com/google/go-github/releases/tag/v38.1.0
[2]: google/go-github#1960
[3]: google/go-github#1901
xun-guo-anzx added a commit to xun-guo-anzx/terraform-provider-github that referenced this pull request Sep 6, 2021
go-github released the Go client library to [38.1.0][1] recently.

API changes includes:
* Add ListOptions required by GetCommit method. As described in change[2]
* Add followRedirects required by GetBranch method and set it to false as start point. As described in change[3]

[1]: https://github.com/google/go-github/releases/tag/v38.1.0
[2]: google/go-github#1960
[3]: google/go-github#1901
xun-guo-anzx added a commit to xun-guo-anzx/terraform-provider-github that referenced this pull request Sep 6, 2021
go-github released the Go client library to [38.1.0][1] recently.

API changes includes:
* Add ListOptions required by GetCommit method. As described in change[2]
* Add followRedirects required by GetBranch method and set it to false as start point. As described in change[3]

[1]: https://github.com/google/go-github/releases/tag/v38.1.0
[2]: google/go-github#1960
[3]: google/go-github#1901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants