Skip to content

github.rest.actions.createWorkflowDispatch does not trigger a run #250

Closed
@bennypowers

Description

@bennypowers

Describe the bug
I've written a step which should trigger a workflow_dispatch run in my repo, but nothing happens

To Reproduce

 - name: Bundle
    id: bundle
    if: ${{ steps.changesets.outputs.published == 'true' }}
    uses: actions/github-script@v6
    with:
      debug: ${{ secrets.ACTIONS_RUNNER_DEBUG }}
      github-token: ${{ secrets.GITHUB_TOKEN }}
      script: |
        try {
          const result = await github.rest.actions.createWorkflowDispatch({
            owner: 'patternfly',
            repo: 'patternfly-elements',
            workflow_id: 'bundle.yml',
            ref: 'main',
            inputs: {
              tags: ${{ steps.get-tags.outputs.tags }}
            },
          })
          console.log(result);
        } catch(error) {
          console.error(error);
          core.setFailed(error);
        }

In this case, This is what I observed logged in the run:

{
  status: 204,
  url: 'https://api.github.com/repos/patternfly/patternfly-elements/actions/workflows/bundle.yml/dispatches',
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
    connection: 'close',
    'content-security-policy': "default-src 'none'",
    date: 'Wed, 16 Mar 2022 23:27:24 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3',
    'x-github-request-id': '07C1:3CFD:580A27:F241C1:6232725C',
    'x-ratelimit-limit': '1000',
    'x-ratelimit-remaining': '947',
    'x-ratelimit-reset': '1647475036',
    'x-ratelimit-resource': 'core',
    'x-ratelimit-used': '53',
    'x-xss-protection': '0'
  },
  data: undefined
}

I've tried several approaches here and I'm really at a loss. What could account for this? Do I need a separate github PAT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions