Skip to content

Actions (#872) - #939

Merged
acrobat merged 1 commit into
KnpLabs:2.xfrom
lexor:lexor/github-actions
Dec 3, 2020
Merged

Actions (#872)#939
acrobat merged 1 commit into
KnpLabs:2.xfrom
lexor:lexor/github-actions

Conversation

@lexor

@lexorlexor commented Nov 25, 2020

Copy link
Copy Markdown
Contributor
  • Artifacts
  • Secrets
  • Self-hosted runners
  • Workflows
  • Workflow jobs
  • Workflow runs

Documentation: https://developer.github.com/v3/actions/

@lexor
lexorforce-pushed the lexor/github-actions branch 3 times, most recently from 0612c92 to c81fadbCompareNovember 26, 2020 01:14
@acrobat

Copy link
Copy Markdown
Collaborator

Thanks for working on this @lexor! Let me know when it's ready for review 🚢

@fodinabor

fodinabor commented Nov 27, 2020

Copy link
Copy Markdown
Contributor

What's missing from the developer.github.com documentation is e.g. dispatching:
https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event

I've been successful with:

/** * @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event * * @param string $username * @param string $repository * @param string $workflowId * @param string $ref * @param array $inputs * * @return array|string */publicfunctiondispatches(string$username, string$repository, string$workflowId, string$ref, array$inputs = [])
{
$parameters = array('ref' => $ref, 'inputs' => $inputs);
return$this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.rawurlencode($workflowId).'/dispatches', $parameters);
}

Another note: workflowId is in most cases allowed to contain the filename of the workflow, so string should be preferred over int

@lexor

lexor commented Nov 28, 2020

Copy link
Copy Markdown
ContributorAuthor

What's missing from the developer.github.com documentation is e.g. dispatching:
docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event

Thanks for sharing the dispatches function, but this pull request based on this documentation. After this pull request I can work on this documentation.

I'm not add organization endpoints (self-hosted runners) because marked on documentation. Organization endpoints currently in public beta and can be change.

Another note: workflowId is in most cases allowed to contain the filename of the workflow, so string should be preferred over int

I think it can be changed from workflowId to workflow.

@lexor
lexorforce-pushed the lexor/github-actions branch 2 times, most recently from 16e1d6d to 4f25590CompareNovember 28, 2020 06:21
@lexorlexor changed the title [WIP] Actions (#872)Actions (#872)Nov 28, 2020
@lexor
lexor marked this pull request as ready for review November 28, 2020 10:18
@lexor

Copy link
Copy Markdown
ContributorAuthor

Hey @acrobat. This pull request awaiting review.

@fodinabor

Copy link
Copy Markdown
Contributor

For Get a workflow for example the docs write:

Gets a specific workflow. You can also replace :workflow_id with :workflow_file_name. For example, you could use main.yml.

So, yeah I guess a string parameter named just workflow would make sense here.

@acrobat

Copy link
Copy Markdown
Collaborator

@fodinabor the repo dispatch api endpoint is already added in #931

@lexor A general remark before I do a full review, can you update the doc links to directly link to the new documentation? Example: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions

@lexor
lexorforce-pushed the lexor/github-actions branch from 4f25590 to 11fa492CompareNovember 29, 2020 16:43
@lexor

lexor commented Nov 29, 2020

Copy link
Copy Markdown
ContributorAuthor

@lexor A general remark before I do a full review, can you update the doc links to directly link to the new documentation? Example: docs.github.com/en/free-pro-team@latest/rest/reference/actions

Done, I updated 👍

@acrobatacrobat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This comment is also applicable to all occurences of non-query parameters

Can you replace the non url parameters with a array $params/parameters , so our code isn't fixed on a certain set of parameters of github decides to add new options.

Can you also add a docs entry for the added endpoints? The rest of PR looks good 👌

Comment threadlib/Github/Api/Organization/Actions/Secrets.php Outdated
Comment threadlib/Github/Api/Repository/Actions/Artifacts.php Outdated
Comment threadlib/Github/Api/Repository/Actions/WorkflowJobs.php Outdated
Comment threadlib/Github/Api/Repository/Actions/WorkflowRuns.php Outdated
@lexor
lexorforce-pushed the lexor/github-actions branch from 11fa492 to 698918dCompareNovember 29, 2020 21:31
feat(actions): added self-hosted runners
Signed-off-by: Emre DEĞER <ben@emre.dev>
repo: added actions
feat(actions): added self-hosted runners
Signed-off-by: Emre DEĞER <ben@emre.dev>
repo: added actions
refactored
fix(actions: reformated self-hosted runners
repo: added actions
refactored
fix(actions: reformated self-hosted runners
feat(actions): added repo's secrets
Signed-off-by: Emre DEĞER <ben@emre.dev>
feat(actions): added organization's secrets
Signed-off-by: Emre DEĞER <ben@emre.dev>
feat(actions): formated
Signed-off-by: Emre DEĞER <ben@emre.dev>
docs(actions): updated php doc blocks
updated `@link` for new docs
Signed-off-by: Emre DEĞER <ben@emre.dev>
feat(actions): updated for requested changes
Signed-off-by: Emre DEĞER <ben@emre.dev>
feat(actions): added docs
Signed-off-by: Emre DEĞER <ben@emre.dev>
feat(actions): updated download example cases
Signed-off-by: Emre DEĞER <ben@emre.dev>
fix(actions): removed todos
Signed-off-by: Emre DEĞER <ben@emre.dev>
@lexor
lexorforce-pushed the lexor/github-actions branch from c5933b1 to 703955eCompareNovember 30, 2020 08:18
@lexor

Copy link
Copy Markdown
ContributorAuthor

Can you replace the non url parameters with a array $params/parameters , so our code isn't fixed on a certain set of parameters of github decides to add new options.

Sure, replaced. Now non url parameters moved on array $parameters.

Can you also add a docs entry for the added endpoints? The rest of PR looks good 👌

I updated functions and test cases. Also added docs for added endpoints.

@lexor
lexor requested a review from acrobatDecember 1, 2020 17:37
@acrobat
acrobat merged commit 0889fc2 into KnpLabs:2.xDec 3, 2020
@acrobat

Copy link
Copy Markdown
Collaborator

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

@lexor
lexor deleted the lexor/github-actions branch December 3, 2020 11:31
@acrobatacrobat mentioned this pull request Dec 3, 2020
6 tasks
@acrobatacrobat linked an issue Dec 3, 2020 that may be closed by this pull request
6 tasks
acrobat added a commit that referenced this pull request Mar 6, 2021
This PR was merged into the 3.0.x-dev branch.
Discussion
----------
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.
Commits
-------
61366b2 Add workflow dispatch and allow workflow names.
@dereuromark

Copy link
Copy Markdown
Contributor

What I am missing is the enable of a specific workflow
See https://docs.github.com/en/rest/reference/actions#enable-a-workflow

@lexor

lexor commented Apr 14, 2021

Copy link
Copy Markdown
ContributorAuthor

What I am missing is the enable of a specific workflow
See docs.github.com/en/rest/reference/actions#enable-a-workflow

Looks like endpoint was added or I missed it. I can create pull request for enable/disable endpoints.

@dereuromark

dereuromark commented Apr 14, 2021

Copy link
Copy Markdown
Contributor

Yeah, might be new.
But I also struggle finding the right syntax.
The docs say this should work:

$url = 'repos/' . rawurlencode($organization) . '/' . rawurlencode($repository) . '/actions/workflows/' . (string)$id . '/enable';
$this->post($url);

But it returns Not Found
I made sure to use a token that has permissions for "Workflows".

The dispatches() example above works, which makes this even weirder.

Sign up for freeto 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.

Github actions api

4 participants

@lexor@acrobat@fodinabor@dereuromark