Home > Blockchain >  How to send data payload using http request to Github-Actions Workflow
How to send data payload using http request to Github-Actions Workflow

Time:11-19

I want to trigger Github-Actions Workflow using http request with data payload and use this data in the workflow script. But I cannot find any documentation on how to send and use that payload data. I am using below curl command to trigger the workflow, but also need to send and use that data payload.

curl \
  -X POST \
  -H "Accept: application/vnd.github.v3 json" \
  --header 'Authorization: token ******' \
  https://api.github.com/repos/aashutosh0012/actions-test/actions/workflows/learn-github-actions.yml/dispatches \
  -d '{"ref":"main"}'

Demo Workflow Yaml file.

name: GitHub Actions Demo
on: [push, workflow_dispatch,repository_dispatch]
jobs:
  Explore-GitHub-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "           
  • Related