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

Commit 5f08a26

Browse files
author
Jinlin Zhang
authored
Release fix (#2482)
* Fixed CircleCI script for buck release * Make sure Python3 exists while creating windows release * Changed logic when reading user emails from GitHub * Refactored code
1 parent b95de0b commit 5f08a26

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.circleci/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,17 @@ jobs:
11961196
executor: win/default
11971197
steps:
11981198
- checkout
1199+
- run:
1200+
name: Make sure Python3 exists
1201+
command: |
1202+
$pythonpath=(Split-Path((Get-Command python).Path))
1203+
If (Test-Path -Path ${pythonpath}\python3.exe) {
1204+
echo "using ${pythonpath}\python3.exe"
1205+
}
1206+
else {
1207+
cmd /c mklink ${pythonpath}\python3.exe ${pythonpath}\python.exe
1208+
}
1209+
shell: powershell.exe
11991210
- run:
12001211
name: Upgrade pip
12011212
command: python3 -m pip install --upgrade pip

tools/release/releases.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ def get_current_user(github_token, prefer_fb_email=True):
6464
response = requests.get(url, headers=headers)
6565
response.raise_for_status()
6666
ret = response.json()
67-
if not ret["email"].endswith("@fb.com") and prefer_fb_email:
67+
default_email = ret["email"]
68+
if default_email is None or (not default_email.endswith("@fb.com") and prefer_fb_email):
6869
while emails_url:
6970
response = requests.get(emails_url, headers=headers)
7071
response.raise_for_status()
7172
fb_email = next(
7273
(
7374
email["email"]
7475
for email in response.json()
75-
if email["verified"] and email["email"].endswith("@fb.com")
76+
if email["verified"] and email["email"].endswith("@fb.com") and (email["visibility"] is None or email["visibility"].lower() == "public")
7677
),
7778
None,
7879
)
@@ -81,6 +82,17 @@ def get_current_user(github_token, prefer_fb_email=True):
8182
break
8283
else:
8384
emails_url = response.links.get("next", {}).get("url")
85+
if default_email is None:
86+
default_email = next(
87+
(
88+
email["email"]
89+
for email in response.json()
90+
if email["verified"] and (email["visibility"] is None or email["visibility"].lower() == "public")
91+
),
92+
None,
93+
)
94+
if ret["email"] is None and not default_email is None:
95+
ret["email"] = default_email
8496
return ret
8597

8698

0 commit comments

Comments
 (0)