Skip to content

Commit

Permalink
[SPARK-45603][INFRA] merge_spark_pr shall notify us about GITHUB_OAUT…
Browse files Browse the repository at this point in the history
…H_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 apache#43447 from yaooqinn/SPARK-45603.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
  • Loading branch information
yaooqinn authored and zhengruifeng committed Oct 20, 2023
1 parent 8fd915f commit 820418a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev/merge_spark_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 820418a

Please sign in to comment.