Skip to content

Commit

Permalink
Utilize the auto generated github token for comments (#74)
Browse files Browse the repository at this point in the history
* feat: use autogenerated github token for pull_request comments

* update secret token usage

Co-authored-by: Gaetan BOGAERT <gaetan.bogaert.partner@decathlon.com>
  • Loading branch information
Rabih Salamey and bogaertg committed Nov 16, 2022
1 parent ef151ef commit f69fa9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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

0 comments on commit f69fa9e

Please sign in to comment.