Merge pull request #13601 from bayandin/cleaup-github-headers
Clean up GitHub headers
This commit is contained in:
commit
1af0bcde20
@ -603,13 +603,13 @@ EOS
|
|||||||
# Only try to `git fetch` when the upstream tags have changed
|
# Only try to `git fetch` when the upstream tags have changed
|
||||||
# (so the API does not return 304: unmodified).
|
# (so the API does not return 304: unmodified).
|
||||||
GITHUB_API_ETAG="$(sed -n 's/^ETag: "\([a-f0-9]\{32\}\)".*/\1/p' ".git/GITHUB_HEADERS" 2>/dev/null)"
|
GITHUB_API_ETAG="$(sed -n 's/^ETag: "\([a-f0-9]\{32\}\)".*/\1/p' ".git/GITHUB_HEADERS" 2>/dev/null)"
|
||||||
GITHUB_API_ACCEPT="application/vnd.github.v3+json"
|
GITHUB_API_ACCEPT="application/vnd.github+json"
|
||||||
GITHUB_API_ENDPOINT="tags"
|
GITHUB_API_ENDPOINT="tags"
|
||||||
else
|
else
|
||||||
# Only try to `git fetch` when the upstream branch is at a different SHA
|
# Only try to `git fetch` when the upstream branch is at a different SHA
|
||||||
# (so the API does not return 304: unmodified).
|
# (so the API does not return 304: unmodified).
|
||||||
GITHUB_API_ETAG="$(git rev-parse "refs/remotes/origin/${UPSTREAM_BRANCH_DIR}")"
|
GITHUB_API_ETAG="$(git rev-parse "refs/remotes/origin/${UPSTREAM_BRANCH_DIR}")"
|
||||||
GITHUB_API_ACCEPT="application/vnd.github.v3.sha"
|
GITHUB_API_ACCEPT="application/vnd.github.sha"
|
||||||
GITHUB_API_ENDPOINT="commits/${UPSTREAM_BRANCH_DIR}"
|
GITHUB_API_ENDPOINT="commits/${UPSTREAM_BRANCH_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -1034,7 +1034,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
|||||||
|
|
||||||
output, _, status = curl_output(
|
output, _, status = curl_output(
|
||||||
"--silent", "--head", "--location",
|
"--silent", "--head", "--location",
|
||||||
"-H", "Accept: application/vnd.github.v3.sha",
|
"-H", "Accept: application/vnd.github.sha",
|
||||||
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{@ref}"
|
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{@ref}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1051,7 +1051,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
|||||||
|
|
||||||
output, _, status = curl_output(
|
output, _, status = curl_output(
|
||||||
"--silent", "--head", "--location",
|
"--silent", "--head", "--location",
|
||||||
"-H", "Accept: application/vnd.github.v3.sha",
|
"-H", "Accept: application/vnd.github.sha",
|
||||||
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{commit}"
|
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{commit}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -184,8 +184,7 @@ module GitHub
|
|||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
|
return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
|
||||||
|
|
||||||
args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%\{http_code}"]
|
args = ["--header", "Accept: application/vnd.github+json", "--write-out", "\n%\{http_code}"]
|
||||||
args += ["--header", "Accept: application/vnd.github.antiope-preview+json"]
|
|
||||||
|
|
||||||
token = credentials
|
token = credentials
|
||||||
args += ["--header", "Authorization: token #{token}"] unless credentials_type == :none
|
args += ["--header", "Authorization: token #{token}"] unless credentials_type == :none
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user