3

jobs: build: runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Test
  run: |
    curl 'https://api.github.com/repos/project/admin/actions/workflows/56876875/dispatches' \
      -H "Accept: application/vnd.github.v3+json" \
      -H "Content-Type: application/json" \
      -H "Authorization: token ***" \
      --data '{"ref": "sharon_trunk_cicd","inputs":{}}'
- uses: actions/checkout@v3
- name: Set up JDK 11
  uses: actions/setup-java@v3
  with:
    java-version: '11'
    distribution: 'temurin'
    cache: maven

We are trying to trigger one workflow from another workflow. Both are in a different repositories. We tried to hit the workflow dispatch API from the postman. It works fine and the workflow is triggered in repository B.

Now we have a Git Actions workflow in repository A it runs whenever a new code is pushed. We have added a curl request to trigger the workflow in repository B in workflow file A.(Curl request is the same as a postman)

Response received as Bad Request. But the same curl request is working in Postman.

Expecting a suggestion to solve this

  • 1
    Either replace `--data` with `-d`, or add `--request POST`. https://stackoverflow.com/questions/7172784/how-do-i-post-json-data-with-curl – Roar S. Mar 30 '23 at 16:40

0 Answers0