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

Get workflow runs for a specific branch. #963

Closed
nextgenthemes opened this issue Jan 24, 2021 · 4 comments
Closed

Get workflow runs for a specific branch. #963

nextgenthemes opened this issue Jan 24, 2021 · 4 comments

Comments

@nextgenthemes
Copy link

nextgenthemes commented Jan 24, 2021

https://docs.github.com/en/rest/reference/actions#list-workflow-runs-for-a-repository

Not sure if I read this right, but it sounds like I should be able to get workflow runs for a branch but I can't found out how I would be able to do this with this. Seems parameters are missing completely.

I am wondering why I am messing with this at all not try some PHP CURL directly. Why is this so complicated? Why does this need additional abstractions to build on top of it? Why does GitHub itself does not have an official PHP lib for this?

I guess I could use https://github.com/KnpLabs/php-github-api/blob/master/doc/request_any_route.md. I would not call this "Extensively Documented".

@lexor
Copy link
Contributor

lexor commented Jan 25, 2021

@nextgenthemes actually already implemented this case on all, show, listRuns methods.

$workflowRuns = $client->api('repo')->workflowRuns()->all('KnpLabs', 'php-github-api', [
    'branch' => 'foo',
]);

@nextgenthemes
Copy link
Author

nextgenthemes commented Jan 25, 2021

@lexor Not documented, AFAIK. Searched long and hard for the docs on this found them not linked, the last $parameters parameter is not documented at all for this. https://github.com/KnpLabs/php-github-api/blob/master/doc/repo/actions/workflow_runs.md

I even guessed there was maybe a one general way for each command to take parameters, searched for general docs on this and did not find anything. So again, without the claim "Extensively Documented" I would not be mad about this ....

Should probably just look at the source in the first place. Ended up doing this, and that also works.

		$response = $client->getHttpClient()->get("/repos/$user/$repo/actions/runs?branch=$tag");
		$data     = Github\HttpClient\Message\ResponseMediator::getContent($response);

@acrobat
Copy link
Collaborator

acrobat commented Jan 26, 2021

Hi @nextgenthemes, this is an opensource project so we are open for contributions to improve our code, docs, tests, etc. So I you find some parts of the documentation not clear, please open a PR to improve the docs for future users. I've created #964 to keep track of this.

That being said, the $parameters argument was indeed not documented so it can be improved. But to already provide some info on this array, you can pass all values of the type query that are supported by the github api in this array. See the documented parameter list

@acrobat
Copy link
Collaborator

acrobat commented Mar 27, 2021

The original issue/question is resolved. The documentation changes are moved to separate issues.

@acrobat acrobat closed this as completed Mar 27, 2021
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

No branches or pull requests

3 participants