Skip to content

Commit

Permalink
MINOR: [Release] Support GitHub token in download_rc_binaries.py (#44666
Browse files Browse the repository at this point in the history
)

### Rationale for this change

See apache/arrow-adbc#2307. This script is getting rate-limited on GitHub Actions.

### What changes are included in this PR?

Pick up GH_TOKEN if it exists.

### Are these changes tested?

N/A

### Are there any user-facing changes?

N/A

Authored-by: David Li <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
lidavidm authored Nov 7, 2024
1 parent ac6b8ff commit df24a82
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dev/release/download_rc_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,22 @@ def __init__(self, repository, tag):
raise ValueError("--tag is required")
self._repository = repository
self._tag = tag
# use the same name as the gh CLI
self._token = os.environ.get("GH_TOKEN")

def get_file_list(self, prefix, filter=None):
url = (f"https://api.github.com/repos/{self._repository}/"
f"releases/tags/{self._tag}")
print("Fetching release from", url)
headers = {
"Accept": "application/vnd.github+json",
}
if self._token:
headers["Authorization"] = f"Bearer {self._token}"
request = urllib.request.Request(
url,
method="GET",
headers={
"Accept": "application/vnd.github+json",
},
headers=headers,
)
raw_response = urllib.request.urlopen(request).read().decode()
response = json.loads(raw_response)
Expand Down

0 comments on commit df24a82

Please sign in to comment.