Skip to content

Commit

Permalink
Use GITHUB_ACCESS_TOKEN environmental variable hiddenly
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed May 5, 2016
1 parent bbde0fa commit 2edd619
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion comment_roslint_result.py
Expand Up @@ -93,7 +93,11 @@ def send_comment(self, owner, repo, pr_num, body, commit_id, path, position):
p.error("file %s not exists" % o.input_path)
sys.exit(1)

c = CommentLintResult(cache_dir=o.cache_dir, github_token=o.token)
try:
token = os.environ['GITHUB_ACCESS_TOKEN']
except KeyError:
print('Please set GITHUB_ACCESS_TOKEN environmental variable')
c = CommentLintResult(cache_dir=o.cache_dir, github_token=token)
if c.run(input_path=o.input_path):
sys.exit(0)
else:
Expand Down
7 changes: 2 additions & 5 deletions travis.sh
Expand Up @@ -204,11 +204,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
$CI_SOURCE_PATH/.travis/get_roslint_result_xml.py $TARGET_PKGS --repo-dir $CI_SOURCE_PATH --repo-slug $TRAVIS_REPO_SLUG --pr-number $TRAVIS_PULL_REQUEST --out-file $ROSLINT_RESULT_PATH || true
if [ -e $ROSLINT_RESULT_PATH ]; then
cat $ROSLINT_RESULT_PATH # TODO(wkentaro): DEBUGGING
if source $HOME/.token; then # get GH_TOKEN that is GitHub API Token
(cd $CI_SOURCE_PATH && .travis/comment_roslint_result.py -i $ROSLINT_RESULT_PATH -t $GH_TOKEN || true)
else
echo "GitHub Token not found. skipping"
fi
# this script requires GITHUB_ACCESS_TOKEN environmental variable
(cd $CI_SOURCE_PATH && .travis/comment_roslint_result.py -i $ROSLINT_RESULT_PATH || true)
else
echo "$ROSLINT_RESULT_PATH not found. skipping"
fi
Expand Down

0 comments on commit 2edd619

Please sign in to comment.