jvalkeal / github-actions-dashboard

Dashboard for Github Actions
5 stars 2 forks source link

Support sending repository dispatch events #17

Closed jvalkeal closed 4 years ago

jvalkeal commented 4 years ago

Some of an external integrations can be accomplished by sending repository dispatch messages to a github v3 api. Action is then able to consume these and do whatever it wants to do.

For example having:

name: Dispatch Say Hi

on:
  repository_dispatch:
    types: [github-actions-dashboard-command]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Show Dispatch Message
      run: |
        echo "Hi $CLIENT_PAYLOAD_MESSAGE"
      env:
        CLIENT_PAYLOAD_MESSAGE: ${{ github.event.client_payload.message }}

Sending below message will fire up an action which eventually will print out a message Hi from manual api call.

POST https://api.github.com/repos/jvalkeal/github-actions-dashboard/dispatches
Content-Type: application/json
Authorization: Bearer {{github}}
Accept: application/vnd.github.everest-preview+json

{
  "event_type": "github-actions-dashboard-command",
  "client_payload": {
    "message": "from manual api call"
  }
}

We want to automate these dispatch events so that user can store those in a platform and then choose one for a repo.