Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k1low/github-script-php
Write workflows scripting the GitHub API in PHP
https://github.com/k1low/github-script-php
actions github-api php
Last synced: about 1 month ago
JSON representation
Write workflows scripting the GitHub API in PHP
- Host: GitHub
- URL: https://github.com/k1low/github-script-php
- Owner: k1LoW
- License: mit
- Created: 2022-03-22T21:28:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T08:21:46.000Z (almost 3 years ago)
- Last Synced: 2024-10-25T04:59:14.223Z (3 months ago)
- Topics: actions, github-api, php
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# github-script-php
This action makes it easy to write PHP scripts in the workflow, just like [actions/github-script](https://github.com/actions/github-script).
In order to use this action, a `script` input is provided. The value of that input should be the body of an function call. The following arguments will be provided:
- `$github` A pre-authenticated [knplabs/github-api](https://github.com/KnpLabs/php-github-api) client
- `$context` An OpenStruct instance containing the context of the workflow run## Examples
### Print the available attributes of context
ref: [actions/github-script example](https://github.com/actions/github-script#print-the-available-attributes-of-context)
``` yaml
- name: View context attributes
uses: k1LoW/github-script-php@v0
with:
script: var_dump($context);
```### Comment on an issue
ref: [actions/github-script example](https://github.com/actions/github-script#comment-on-an-issue)
``` yaml
on:
issues:
types: [opened]jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: k1LoW/github-script-php@v0
with:
script: |
$owner = $context->repo->owner;
$repo = $context->repo->repo;
$number = $context->issue->number;
$comment = '👋 Thanks for reporting!';
$github->api('issue')->comments()->create($owner, $repo, $number, array('body' => $comment));
```## References
- [actions/github-script](https://github.com/actions/github-script): Write workflows scripting the GitHub API in JavaScript