Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add example with valid payload which trigger and wait for workflow in other repository? #82

Open
danieltalmor369 opened this issue Feb 7, 2023 · 6 comments

Comments

@danieltalmor369
Copy link

I provided a json string

- name: Execute deployment and wait for finish
        uses: convictional/[email protected]
        with:
          owner: ME
          repo: my-workflows
          github_token: ${{ secrets. GITHUB_TOKEN }}
          github_user: ${{ github.event.client_payload.actor }}
          workflow_file_name: deployment.yml
          ref: ${{ github.event.inputs.ref }}
          client_payload: '{"ref": "master", "inputs": {"repository": "${{ github.event.inputs.repository }}", "ref": "${{ github.event.inputs.ref }}", "environment": "${{ github.event.inputs.environment }}", "service_to_deploy": "${{ github.event.inputs.service_to_deploy }}"}}'

But I get an error on the payload:

curl: (22) The requested URL returned error: 422 is not a string
@loki1978
Copy link

loki1978 commented Feb 22, 2023

        - uses: convictional/[email protected]
        with:
            owner: BAC
            repo: xyz
            github_token: ${{ secrets.TOKEN }}
            github_user: user10
            workflow_file_name: metrics.yml
            ref: master
            wait_interval: 2
            client_payload: '{"repository": "ABC", "application": "12", "deploy_tag": "ABC", "previous_deploy_tag": "ABC", "deploy_status": "true", "build_duration": "12.5"}'
            trigger_workflow: true
            wait_workflow: true

@danieltalmor369
Copy link
Author

Thanks @loki1978
I still getting the same error

curl: (22) The requested URL returned error: 422
api failed:
path: workflows/qa_deployment.yml/dispatches
response: {
  "message": "Invalid request.\n\nFor 'additionalProperties', {\"repository\"=>\"klinse\", \"ref\"=>\"feature/johnnyT/Aicore-20/combine-deploy-workflows\", \"environment\"=>\"qa-1\", \"env_start\"=>\"disabled\", \"service_to_deploy\"=>\"data_ingestor\"} is not a string.",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

I try to wait for external workflow (which locate in other repository.
Do I need to set something on the triggered workflow?

@FelixZilber
Copy link

Same for me.

using client_payload: '{"data":"I am a custom client_payload"}'
results in
Triggering workflow: workflows/testing-workflow.yml/dispatches {"ref":"master","inputs":{"data":"I am a custom client_payload"}} curl: (22) The requested URL returned error: 422 api failed: path: workflows/testing-workflow.yml/dispatches response: { "message": "Unexpected inputs provided: [\"data\"]", "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event" }

@loki1978
Copy link

loki1978 commented Mar 23, 2023

Thanks @loki1978 I still getting the same error

curl: (22) The requested URL returned error: 422
api failed:
path: workflows/qa_deployment.yml/dispatches
response: {
  "message": "Invalid request.\n\nFor 'additionalProperties', {\"repository\"=>\"klinse\", \"ref\"=>\"feature/johnnyT/Aicore-20/combine-deploy-workflows\", \"environment\"=>\"qa-1\", \"env_start\"=>\"disabled\", \"service_to_deploy\"=>\"data_ingestor\"} is not a string.",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

I try to wait for external workflow (which locate in other repository. Do I need to set something on the triggered workflow?

Triggered workflow need workflow dispatch and inputs ( optional )

  workflow_dispatch:
    inputs:

@KeshariPiyush24
Copy link

KeshariPiyush24 commented Apr 1, 2023

Thanks @loki1978 I still getting the same error

curl: (22) The requested URL returned error: 422
api failed:
path: workflows/qa_deployment.yml/dispatches
response: {
  "message": "Invalid request.\n\nFor 'additionalProperties', {\"repository\"=>\"klinse\", \"ref\"=>\"feature/johnnyT/Aicore-20/combine-deploy-workflows\", \"environment\"=>\"qa-1\", \"env_start\"=>\"disabled\", \"service_to_deploy\"=>\"data_ingestor\"} is not a string.",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

I try to wait for external workflow (which locate in other repository. Do I need to set something on the triggered workflow?

Triggered workflow need workflow dispatch and inputs ( optional )

  workflow_dispatch:
    inputs:

Yes the workflow which you are triggering should have:

on:
  workflow_dispatch:

@dannyevinced
Copy link

doesn't work for me either.
an alternative solution: share params using organization variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants