octokit / octokit.net

A GitHub API client library for .NET
https://octokitnet.readthedocs.io/en/latest/
MIT License
2.62k stars 1.07k forks source link

[BUG]: WorkflowJobStatus enum does not contain "pending" value. #2882

Closed redoz closed 3 months ago

redoz commented 3 months ago

What happened?

I get an exception when trying to read the value of WorkflowJobStep.Status as it sends 'pending' but that's not a valid value for that Enum. It seems very similar to this issue from last year: https://github.com/octokit/octokit.net/issues/2656

Versions

Using Octokit 9.1.2 on .NET 8 running on Windows.

Relevant log output

No response

Code of Conduct

redoz commented 3 months ago

@kfcampbell should the existing enum just be extended with a Pending member, or is the fix to split this into a separate enum WorkflowJobStepStatus? I didn't see anything int he REST API docs what the legal values for this enum were, and it already has a Waiting which seems like it would be the same as Pending?

kfcampbell commented 3 months ago

@redoz I'm sorry I'm a bit confused. Your title mentions WorkflowJobStatus but the description mentions WorkflowJobStep. Do you mind linking to the documentation you're looking at here?

redoz commented 3 months ago

@kfcampbell Sorry for the confusion, I'm getting the error while accessing the Status property on the WorkflowJobStep, that property is of type StringEnum<WorkflowJobStatus> which is the same type of the Status property on the WorkflowJob type. It wasn't clear if they are referring to the same status (of the WorkflowJob), or if the enum is just re-used to represent the state of the WorkflowJobStep.

I can easily submit a PR to add the Pending value to this enum, but I wasn't sure if this was the correct fix, or if there is more to this than it seems, given that the enum already has a Waiting member.

And maybe I'm looking at the wrong place but it seems the step is documented to have the following statuses: image based on this documentation: https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28

So, before I put effort into submitting a PR, I figured I'd ask for some clarification to make sure it got fixed correctly. I hope that makes more sense, thanks for your time so far!

kfcampbell commented 3 months ago

Thanks for the detailed explanation! I've done a little code spelunking internally and I think it's appropriate to add a Pending value here.