Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Release fix (#2482)
Browse files Browse the repository at this point in the history
* Fixed CircleCI script for buck release

* Make sure Python3 exists while creating windows release

* Changed logic when reading user emails from GitHub

* Refactored code
  • Loading branch information
Jinlin Zhang authored Jun 22, 2020
1 parent b95de0b commit 5f08a26
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,17 @@ jobs:
executor: win/default
steps:
- checkout
- run:
name: Make sure Python3 exists
command: |
$pythonpath=(Split-Path((Get-Command python).Path))
If (Test-Path -Path ${pythonpath}\python3.exe) {
echo "using ${pythonpath}\python3.exe"
}
else {
cmd /c mklink ${pythonpath}\python3.exe ${pythonpath}\python.exe
}
shell: powershell.exe
- run:
name: Upgrade pip
command: python3 -m pip install --upgrade pip
Expand Down
16 changes: 14 additions & 2 deletions tools/release/releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ def get_current_user(github_token, prefer_fb_email=True):
response = requests.get(url, headers=headers)
response.raise_for_status()
ret = response.json()
if not ret["email"].endswith("@fb.com") and prefer_fb_email:
default_email = ret["email"]
if default_email is None or (not default_email.endswith("@fb.com") and prefer_fb_email):
while emails_url:
response = requests.get(emails_url, headers=headers)
response.raise_for_status()
fb_email = next(
(
email["email"]
for email in response.json()
if email["verified"] and email["email"].endswith("@fb.com")
if email["verified"] and email["email"].endswith("@fb.com") and (email["visibility"] is None or email["visibility"].lower() == "public")
),
None,
)
Expand All @@ -81,6 +82,17 @@ def get_current_user(github_token, prefer_fb_email=True):
break
else:
emails_url = response.links.get("next", {}).get("url")
if default_email is None:
default_email = next(
(
email["email"]
for email in response.json()
if email["verified"] and (email["visibility"] is None or email["visibility"].lower() == "public")
),
None,
)
if ret["email"] is None and not default_email is None:
ret["email"] = default_email
return ret


Expand Down

0 comments on commit 5f08a26

Please sign in to comment.