Skip to content

Commit

Permalink
Add token as an action input
Browse files Browse the repository at this point in the history
for when add_pr_comment is enabled
  • Loading branch information
solvaholic committed Jan 11, 2021
1 parent 03071cd commit d42b3f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ inputs:
not do it.'
required: false
default: ''
pr_comment_token:
description: 'Provide a token to use, if you set add_pr_comment to Yes.'
required: true
default: 'Not set'

runs:
using: 'docker'
image: 'docker://ghcr.io/solvaholic/octodns-sync:issue35'
env:
ADD_PR_COMMENT: ${{ inputs.add_pr_comment }}
PR_COMMENT_TOKEN: ${{ inputs.pr_comment_token }}
args:
- ${{ inputs.config_path }}
- ${{ inputs.doit }}
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ fi
if [ "${ADD_PR_COMMENT}" = "Yes" ]; then
echo "INFO: \$ADD_PR_COMMENT is 'Yes'."
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
if [ -z "${GITHUB_TOKEN}" ]; then
echo "FAIL: \$GITHUB_TOKEN is not set."
if [ -z "${PR_COMMENT_TOKEN}" ]; then
echo "FAIL: \$PR_COMMENT_TOKEN is not set."
exit 1
fi
else
Expand All @@ -66,7 +66,7 @@ $(cat "${_planfile}")
${_footer}"
# Post the comment
_user="fakename" \
_token="${GITHUB_TOKEN}" \
_token="${PR_COMMENT_TOKEN}" \
_body="${_body}" \
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" \
python3 -c "import requests, os, json
Expand Down

0 comments on commit d42b3f1

Please sign in to comment.