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

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


The following commit(s) were added to refs/heads/master by this push:
     new 820418aec1c [SPARK-45603][INFRA] merge_spark_pr shall notify us about 
GITHUB_OAUTH_KEY expiry
820418aec1c is described below

commit 820418aec1cd9eb7f5ef703219546e9233c83b94
Author: Kent Yao <y...@apache.org>
AuthorDate: Fri Oct 20 09:02:31 2023 +0800

    [SPARK-45603][INFRA] merge_spark_pr shall notify us about GITHUB_OAUTH_KEY 
expiry
    
    ### What changes were proposed in this pull request?
    
    This PR handles unauthorized errors when calling github rest API to notify 
us about the
    GITHUB_OAUTH_KEY expiry as the current hint does not help
    
    ```
    git rev-parse --abbrev-ref HEAD
    Unable to fetch URL, exiting: 
https://api.github.com/repos/apache/spark/branches
    Restoring head pointer to master
    ```
    
    ### Why are the changes needed?
    
    improve infra scripts
    
    ### Does this PR introduce _any_ user-facing change?
    
    no
    
    ### How was this patch tested?
    
    ```shell
    ./dev/merge_spark_pr.py
    git rev-parse --abbrev-ref HEAD
    GITHUB_OAUTH_KEY is invalid or expired. Please regenerate a new one with at 
least the 'public_repo' scope on https://github.com/settings/tokens and update 
your local settings before you try again.
    Restoring head pointer to master
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    no
    
    Closes #43447 from yaooqinn/SPARK-45603.
    
    Authored-by: Kent Yao <y...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 dev/merge_spark_pr.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index 41ea921bb86..643bc37ced1 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -85,6 +85,12 @@ def get_json(url):
                 + "dev/merge_spark_pr.py to configure an OAuth token for 
making authenticated "
                 + "GitHub requests."
             )
+        elif e.code == 401:
+            print(
+                "GITHUB_OAUTH_KEY is invalid or expired. Please regenerate a 
new one with "
+                + "at least the 'public_repo' scope on 
https://github.com/settings/tokens and "
+                + "update your local settings before you try again."
+            )
         else:
             print("Unable to fetch URL, exiting: %s" % url)
         sys.exit(-1)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to