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 create_dispatch method that raises exceptions #2966

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dblanchette
Copy link
Contributor

(Reopen broken #2965)

We've been having issues with creating workflow dispatch with missing/too many arguments.

When using Workflow.create_dispatch(), we only get a boolean response even though the GitHub API returns detailed error messages.

This creates a new method that returns an exception with the error data when it fails. I did that not to break the existing method.

@EnricoMi
Copy link
Collaborator

See #2760 as the general design issue.

@EnricoMi
Copy link
Collaborator

EnricoMi commented May 21, 2024

Maybe we should add attribute throw: bool = False to create_dispatch, which when False exhibits the current (flawed) behaviour (return status == 204), and when set True calls into requestJsonAndCheck, which will raise errors when status is not 2xx.

In v3, throw will be set to True as the default (breaking change) and will eventually be removed.

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.

None yet

2 participants