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

Add workflow dispatch and allow workflow names. #969

Merged
merged 1 commit into from
Mar 6, 2021
Merged

Add workflow dispatch and allow workflow names. #969

merged 1 commit into from
Mar 6, 2021

Conversation

fodinabor
Copy link
Contributor

Adds the workflow dispatch proposed in #939.
This is different from the repository dispatch, as here it is clear what arguments to use, so that this is much more convenient to use.

Also update docs link.

@bummzack
Copy link

bummzack commented Mar 3, 2021

I'm looking for this functionality as well. Any chance to get this merged?
Or are there currently other ways to trigger a workflow-dispatch event?

@bummzack
Copy link

bummzack commented Mar 3, 2021

I've tested using this PR, but there's an issue when dispatching without the optional $inputs param.

For 'properties/inputs', [] is not an object.

I think inputs should be omitted if there's no input to be specified… this works:

public function dispatches(string $username, string $repository, string $workflow, string $ref, array $inputs = null)
{
    $parameters = array_filter(['ref' => $ref, 'inputs' => $inputs]);

    return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.rawurlencode($workflow).'/dispatches', $parameters);
}

Copy link
Collaborator

@acrobat acrobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! 1 general remark/question, can you remove the @link url changes and move them to a seperate PR as they are not related to this specific feature. This will allow the git history to give a better insight in why a certain change was done. Thanks!

Apart from 2 comments on the dispatch methods, this pr looks good! 👌

lib/Github/Api/Repository/Actions/Workflows.php Outdated Show resolved Hide resolved
lib/Github/Api/Repository/Actions/Workflows.php Outdated Show resolved Hide resolved
@fodinabor
Copy link
Contributor Author

should be non-BC breaking now (even though Roave still doesn't like it), will wait for the URL update until this is merged

@acrobat acrobat merged commit d78089b into KnpLabs:master Mar 6, 2021
@acrobat
Copy link
Collaborator

acrobat commented Mar 6, 2021

Thanks @fodinabor! And congrats on your first contribution! 🎉

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

Successfully merging this pull request may close these issues.

3 participants