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

Looking for code example #128

Closed
hspecter758 opened this issue Apr 1, 2021 · 6 comments
Closed

Looking for code example #128

hspecter758 opened this issue Apr 1, 2021 · 6 comments
Labels

Comments

@hspecter758
Copy link

I have a GitHub Workflow with a Workflow Dispatch trigger.

Is there any code example how to use this action to make a REST call to call another workflow with a Dispatch trigger?

@zhangyoufu
Copy link

- uses: actions/github-script@v4
  with:
    github-token: ${{secrets.PERSONAL_ACCESS_TOKEN}}
    script: |-
      await github.actions.createWorkflowDispatch({
          owner: context.repo.owner,
          repo: context.repo.repo,
          workflow_id: 'another_workflow.yml',
          ref: context.ref,
          inputs: {
            foo: 'bar',
          },
      }).catch(error => error).then(response => {
        core.debug(response);
        if (response.status !== 204) {
          core.setFailed(`create workflow_dispatch received status code ${response.status}`);
        }
      });

@AllanXu49
Copy link

Thank you!

@github-actions
Copy link

This issue is stale because it has been open for 60 days with no activity. Remove the "Stale" label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jun 26, 2021
@github-actions
Copy link

github-actions bot commented Jul 3, 2021

This issue has been marked as stale and closed due to no activity on it.

@github-actions github-actions bot closed this as completed Jul 3, 2021
@leandroboeing-zebra
Copy link

But what is the event that another_workflow.yml uses?

on: workflow_dispatched

What do you use here?

@13013SwagR
Copy link

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

No branches or pull requests

5 participants