You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2022/11/04 23:52:34 UTC

[arrow] branch master updated: ARROW-18248: [CI][Release] Use GitHub token to avoid API rate limit (#14588)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 2cac16b7c5 ARROW-18248: [CI][Release] Use GitHub token to avoid API rate limit (#14588)
2cac16b7c5 is described below

commit 2cac16b7c5c7732d36a9c15147b1135ad5256e13
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Sat Nov 5 08:52:28 2022 +0900

    ARROW-18248: [CI][Release] Use GitHub token to avoid API rate limit (#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 <ko...@clear-code.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 .github/workflows/dev.yml     |  2 ++
 dev/release/02-source-test.rb |  9 ++++++++-
 dev/release/02-source.sh      | 16 +++++++++-------
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 70e450e744..7ff91258f8 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -100,6 +100,8 @@ jobs:
         run: |
           pip install cython setuptools six pytest jira
       - name: Run Release Test
+        env:
+          ARROW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         shell: bash
         run: |
           ci/scripts/release_test.sh $(pwd)
diff --git a/dev/release/02-source-test.rb b/dev/release/02-source-test.rb
index 4d15499a95..85718b6645 100644
--- a/dev/release/02-source-test.rb
+++ b/dev/release/02-source-test.rb
@@ -110,7 +110,14 @@ class SourceTest < Test::Unit::TestCase
                      "?state=open" +
                      "&head=apache:release-#{@release_version}-rc0")
     verify_pr_url = nil
-    verify_prs.open("Accept" => "application/vnd.github+json") do |response|
+    headers = {
+      "Accept" => "application/vnd.github+json",
+    }
+    github_token = ENV["ARROW_GITHUB_API_TOKEN"]
+    if github_token
+      headers["Authorization"] = "Bearer #{github_token}"
+    end
+    verify_prs.open(headers) do |response|
       verify_pr_url = (JSON.parse(response.read)[0] || {})["html_url"]
     end
     output = source("VOTE")
diff --git a/dev/release/02-source.sh b/dev/release/02-source.sh
index 983c244601..984d7af594 100755
--- a/dev/release/02-source.sh
+++ b/dev/release/02-source.sh
@@ -145,13 +145,15 @@ if [ ${SOURCE_VOTE} -gt 0 ]; then
   jira_url="https://issues.apache.org/jira"
   jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}"
   n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total")
-  verify_pr_url=$(curl \
-                    --header "Accept: application/vnd.github+json" \
-                    --get \
-                    --data "state=open" \
-                    --data "head=apache:${rc_branch}" \
-                    https://api.github.com/repos/apache/arrow/pulls | \
-                    jq -r ".[0].html_url")
+  curl_options=(--header "Accept: application/vnd.github+json")
+  if [ -n "${ARROW_GITHUB_API_TOKEN:-}" ]; then
+    curl_options+=(--header "Authorization: Bearer ${ARROW_GITHUB_API_TOKEN}")
+  fi
+  curl_options+=(--get)
+  curl_options+=(--data "state=open")
+  curl_options+=(--data "head=apache:${rc_branch}")
+  curl_options+=(https://api.github.com/repos/apache/arrow/pulls)
+  verify_pr_url=$(curl "${curl_options[@]}" | jq -r ".[0].html_url")
   echo "The following draft email has been created to send to the"
   echo "dev@arrow.apache.org mailing list"
   echo ""