Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize the auto generated github token for comments #74

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ When deploying an app you may need to deploy additional services, this Github Ac
| `propagate_failure` | False | `true` | Fail current job if downstream job fails. |
| `trigger_workflow` | False | `true` | Trigger the specified workflow. |
| `wait_workflow` | False | `true` | Wait for workflow to finish. |
| `comment_downstream_url` | False | '' | A comments API URL to comment the current downstream job URL to. Default: no comment |
| `comment_downstream_url` | False | `` | A comments API URL to comment the current downstream job URL to. Default: no comment |
| `comment_github_token` | False | `${{github.token}}` | token used for pull_request comments |


## Example
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ inputs:
description: 'Comment API link for commenting the downstream job URL'
required: false
default: ''
comment_github_token:
description: "The Github access token with access to the repository for comment URL. It is recommended you put this token under secrets."
required: false
default: ${{ github.token }}
outputs:
workflow_id:
description: The ID of the workflow that was triggered by this action
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ trigger_workflow() {
comment_downstream_link() {
if response=$(curl --fail-with-body -sSL -X POST \
"${INPUT_COMMENT_DOWNSTREAM_URL}" \
-H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" \
-H "Authorization: Bearer ${INPUT_COMMENT_GITHUB_TOKEN}" \
-H 'Accept: application/vnd.github.v3+json' \
-d "{\"body\": \"Running downstream job at $1\"}")
then
Expand Down