Skip to content

Commit ee81860

Browse files
committed
Include PAT regen link in index.py output
1 parent 70ec6fc commit ee81860

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.circle/index.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import hashlib
66
import json
77
import os
8+
import sys
89
import subprocess
910
import time
1011
from collections import OrderedDict
@@ -21,6 +22,7 @@
2122

2223
GITHUB_USERNAME = os.environ.get('MACHINE_USER')
2324
GITHUB_PASSWORD = os.environ.get("MACHINE_PASSWORD", os.environ.get("GH_TOKEN"))
25+
ACTIVE_PACK_NAME = os.environ.get('PACK_NAME', "unknown")
2426

2527
SESSION = requests.Session()
2628
SESSION.auth = (GITHUB_USERNAME, GITHUB_PASSWORD)
@@ -149,6 +151,13 @@ def get_available_versions():
149151
proc.kill()
150152
outs, _ = proc.communicate()
151153
result = outs.decode().strip()
154+
if proc.returncode != 0:
155+
sys.exit(
156+
"Error retrieving data with github graphql API.\n"
157+
"The Github PAT might need to be regenerated:\n"
158+
"https://github.com/settings/tokens/new?scopes=public_repo"
159+
"&description=CircleCI%3A%20stackstorm-" + ACTIVE_PACK_NAME
160+
)
152161

153162
# https://stackoverflow.com/a/43807246/1134951
154163
decoder = json.JSONDecoder()

0 commit comments

Comments
 (0)