0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-24 18:09:26 -05:00

user: actions: add github context

With event examples for pull requests

Fixes: https://codeberg.org/forgejo/docs/issues/345
This commit is contained in:
Earl Warren 2024-01-09 23:42:30 +01:00
parent b6af104871
commit f999b399bf
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -363,6 +363,43 @@ In addition the following variables are defined by default:
[Check out the example](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions/example-context/.forgejo/workflows/test.yml). [Check out the example](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions/example-context/.forgejo/workflows/test.yml).
### github
The following are identical to the matching environment variable
(e.g. `github.base_ref` is the same as `env.GITHUB_BASE_REF`):
| Name |
| ----------------- |
| action_path |
| action_repository |
| actions |
| actor |
| api_url |
| base_ref |
| head_ref |
| event_name |
| event_path |
| job |
| output |
| ref |
| ref_name |
| repository |
| repository_owner |
| run_number |
| server_url |
| sha |
| token |
| workspace |
The `github.event` object is set to the payload associated with the
event (`github.event_name`) that triggered the workflow.
- `pull_request` and `pull_request_event` events produced by [an example workflow](https://code.forgejo.org/forgejo/end-to-end/src/commit/bc1e2aafa98850f8c366e4d7388dd6bdb98933ee/actions/example-pull-request/.forgejo/workflows/test.yml).
- `pull_request` from the [same repository](https://codeberg.org/forgejo/docs/src/branch/v1.21/docs/user/actions-contexts/pull-request/root/pull_request/github)
- `pull_request` from a [forked repository](https://codeberg.org/forgejo/docs/src/branch/v1.21/docs/user/actions-contexts/pull-request/fork/pull_request/github)
- `pull_request_target` from the [same repository](https://codeberg.org/forgejo/docs/src/branch/v1.21/docs/user/actions-contexts/pull-request/root/pull_request_target/github)
- `pull_request_target` from a [forked repository](https://codeberg.org/forgejo/docs/src/branch/v1.21/docs/user/actions-contexts/pull-request/fork/pull_request_target/github)
## Workflow reference guide ## Workflow reference guide
The syntax and semantics of the YAML file describing a `workflow` are _partially_ explained here. When an entry is missing the [GitHub Actions](https://docs.github.com/en/actions) documentation may be helpful because there are similarities. But there also are significant differences that require testing. The syntax and semantics of the YAML file describing a `workflow` are _partially_ explained here. When an entry is missing the [GitHub Actions](https://docs.github.com/en/actions) documentation may be helpful because there are similarities. But there also are significant differences that require testing.