Skip to content

Commit 74f5081

Browse files
committed
Provide PAT error message as early as possible
1 parent 7b7b28e commit 74f5081

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.circle/deployment

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ type gh &>/dev/null || ~/ci/.circle/install_gh
2525
export GH_TOKEN=${MACHINE_PASSWORD}
2626
source ~/ci/tools/functions.sh
2727

28+
DEFAULT_BRANCH=$(_gh_default_branch)
29+
# Give a good error message after the first use of github API in this script.
30+
if $? != 0; then
31+
echo "Error retrieving data with github graphql API."
32+
echo "The GitHub PAT might need to be regenerated:"
33+
echo "https://github.com/settings/tokens/new?scopes=public_repo&description=CircleCI%3A%20stackstorm-${PACK_NAME}"
34+
else
35+
echo "GitHub PAT is active."
36+
fi
37+
2838
# TODO: figure out how to make deploy.py rebuild the index.
2939
# python ~/packs/.circle/deploy.py pack.yaml "${CIRCLE_PROJECT_REPONAME}"
3040

@@ -58,7 +68,6 @@ do
5868
fi
5969
done
6070

61-
DEFAULT_BRANCH=$(_gh_default_branch)
6271
# Afer pushing the version, make sure we check out the latest commit
6372
# This is important so index reflects latest changes
6473
git checkout ${DEFAULT_BRANCH}

.circle/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def get_available_versions():
155155
if proc.returncode != 0:
156156
sys.exit(
157157
"Error retrieving data with github graphql API.\n"
158-
"The Github PAT might need to be regenerated:\n"
158+
"The GitHub PAT might need to be regenerated:\n"
159159
"https://github.com/settings/tokens/new?scopes=public_repo"
160160
"&description=CircleCI%3A%20stackstorm-" + ACTIVE_PACK_NAME
161161
)

0 commit comments

Comments
 (0)