Skip to content

Commit

Permalink
feat(repository-dispatch-notify): reference to trigger the event on
Browse files Browse the repository at this point in the history
  • Loading branch information
remdub committed Oct 22, 2024
1 parent 8645bd8 commit 8fc9244
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ Trigger a repository dispatch event and optionally notify on Mattermost
| name | required | type | default | description |
| ---------------------- | -------- | ------ | --------------- | ----------- |
| REPOSITORY | yes | string | | Repository to trigger the dispatch event |
| GIT_REFERENCE | no | string | "main" | Reference to trigger the event on |
| REPOSITORY_OWNER | yes | string | | Repository owner |
| EVENT_TYPE | yes | string | | Type of event to trigger |
| WORKFLOW_FILENAME | yes | string | | Filename of the workflow to trigger |
| CLIENT_PAYLOAD | no | string | | Client payload to send with the event |
| APP_ID | yes | string | | GitHub App ID |
| APP_PRIVATE_KEY | yes | string | | GitHub App private key |
Expand Down
11 changes: 9 additions & 2 deletions repository-dispatch-notify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ inputs:
REPOSITORY:
description: 'Repository to trigger the dispatch event'
required: true
GIT_REFERENCE:
description: 'Reference to trigger the event on'
required: false
default: 'main'
WORKFLOW_FILENAME:
description: 'Filename of the workflow to trigger'
required: true
EVENT_TYPE:
description: 'Type of event to trigger'
required: true
Expand Down Expand Up @@ -47,8 +54,8 @@ runs:
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ inputs.REPOSITORY_OWNER}}/${{ inputs.REPOSITORY }}/dispatches \
-d '{"event_type":"${{ inputs.EVENT_TYPE }}"}'
https://api.github.com/repos/${{ inputs.REPOSITORY_OWNER}}/${{ inputs.REPOSITORY }}/actions/workflows/${{ inputs.WORKFLOW_FILENAME }}/dispatches \
-d '{"ref": "${{ inputs.GIT_REFERENCE }}"}'
shell: bash
- name : Send notification on Mattermost
if: ${{ inputs.MATTERMOST_WEBHOOK_URL != '' }}
Expand Down

0 comments on commit 8fc9244

Please sign in to comment.