Skip to content

Commit d92059b

Browse files
taiki-ectz
andcommitted
Include user-agent header in requests to crates.io
Based on taiki-e/cache-cargo-install-action@3f363be by Joe Birr-Pixton. Fix the underlying cause of #1005. Co-authored-by: Joe Birr-Pixton <jpixton@gmail.com>
1 parent d12e869 commit d92059b

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ runs:
4949
INPUT_CHECKSUM: ${{ inputs.checksum }}
5050
INPUT_FALLBACK: ${{ inputs.fallback }}
5151
DEFAULT_GITHUB_TOKEN: ${{ github.token }}
52+
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})

main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ read_manifest() {
220220
# TODO: don't hardcode tool name and use 'immediate_yank_reflection' field in base manifest.
221221
case "${tool}" in
222222
cargo-nextest | nextest)
223-
crate_info=$(curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "https://crates.io/api/v1/crates/${rust_crate}" || true)
223+
crate_info=$(curl -v --user-agent "${ACTION_USER_AGENT}" --proto '=https' --tlsv1.2 -fsSL --retry 10 "https://crates.io/api/v1/crates/${rust_crate}" || true)
224224
if [[ -n "${crate_info}" ]]; then
225225
while true; do
226226
yanked=$(jq -r ".versions[] | select(.num == \"${exact_version}\") | .yanked" <<<"${crate_info}")

0 commit comments

Comments
 (0)