Skip to content

Commit 2cac16b

Browse files
authored
ARROW-18248: [CI][Release] Use GitHub token to avoid API rate limit (apache#14588)
https://github.com/apache/arrow/actions/runs/3387695588/jobs/5628769268#step:7:25 Error: test_vote(SourceTest): OpenURI::HTTPError: 403 rate limit exceeded Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent a3ef64b commit 2cac16b

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎.github/workflows/dev.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
run: |
101101
pip install cython setuptools six pytest jira
102102
- name: Run Release Test
103+
env:
104+
ARROW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103105
shell: bash
104106
run: |
105107
ci/scripts/release_test.sh $(pwd)

‎dev/release/02-source-test.rb‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ def test_vote
110110
"?state=open" +
111111
"&head=apache:release-#{@release_version}-rc0")
112112
verify_pr_url = nil
113-
verify_prs.open("Accept" => "application/vnd.github+json") do |response|
113+
headers = {
114+
"Accept" => "application/vnd.github+json",
115+
}
116+
github_token = ENV["ARROW_GITHUB_API_TOKEN"]
117+
if github_token
118+
headers["Authorization"] = "Bearer #{github_token}"
119+
end
120+
verify_prs.open(headers) do |response|
114121
verify_pr_url = (JSON.parse(response.read)[0] || {})["html_url"]
115122
end
116123
output = source("VOTE")

‎dev/release/02-source.sh‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ if [ ${SOURCE_VOTE} -gt 0 ]; then
145145
jira_url="https://issues.apache.org/jira"
146146
jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}"
147147
n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total")
148-
verify_pr_url=$(curl \
149-
--header "Accept: application/vnd.github+json" \
150-
--get \
151-
--data "state=open" \
152-
--data "head=apache:${rc_branch}" \
153-
https://api.github.com/repos/apache/arrow/pulls | \
154-
jq -r ".[0].html_url")
148+
curl_options=(--header "Accept: application/vnd.github+json")
149+
if [ -n "${ARROW_GITHUB_API_TOKEN:-}" ]; then
150+
curl_options+=(--header "Authorization: Bearer ${ARROW_GITHUB_API_TOKEN}")
151+
fi
152+
curl_options+=(--get)
153+
curl_options+=(--data "state=open")
154+
curl_options+=(--data "head=apache:${rc_branch}")
155+
curl_options+=(https://api.github.com/repos/apache/arrow/pulls)
156+
verify_pr_url=$(curl "${curl_options[@]}" | jq -r ".[0].html_url")
155157
echo "The following draft email has been created to send to the"
156158
echo "dev@arrow.apache.org mailing list"
157159
echo ""

0 commit comments

Comments
 (0)