Forgejo Pull Request Trigger
See Forgejo Triggers for an overview and Event Triggers for generic options like title, target, and if.
Placing the following snippet at the top of an RWX file will result in all tasks in the file running any time a Forgejo pull request is opened, synchronized, or reopened.
on:
forgejo:
pull-request:
It's common to pass values from the event as init parameters into tasks.
on:
forgejo:
pull-request:
init:
commit-sha: ${{ event.git.sha }}
base:
image: ubuntu:24.04
config: rwx/base 1.0.2
tasks:
- key: code
call: git/clone 2.0.7
with:
repository: [email protected]:YOUR_ORG/YOUR_REPO.git
ref: ${{ init.commit-sha }}
ssh-key: ${{ forgejo['YOUR_ORG/YOUR_REPO'].ssh-key }}
Event Fields
The following values are available in the event context for Forgejo pull request triggers:
| Path | Description |
|---|---|
event.git.sha | The SHA of the commit that triggered the event. |
event.git.ref | The ref of the pull request. |
event.forgejo.pull-request.action | The action that triggered the event (opened, synchronize, reopened, closed). |
event.forgejo.pull-request.pull_request.number | The number of the pull request. |
event.forgejo.pull-request.pull_request.title | The title of the pull request. |
event.forgejo.pull-request.pull_request.html_url | The URL of the pull request. |
event.forgejo.pull-request.pull_request.head.ref | The source branch of the pull request. |
event.forgejo.pull-request.pull_request.head.sha | The SHA of the pull request head commit. |
event.forgejo.pull-request.pull_request.user.login | The login of the pull request author. |
event.forgejo.pull-request.repository.id | The ID of the Forgejo repository. |
event.forgejo.pull-request.repository.full_name | The full name of the repository (e.g., org/project). |
event.forgejo.pull-request.repository.html_url | The web URL of the repository. |
event.forgejo.pull-request.sender.login | The login of the user who triggered the event. |
For all values available in the event.forgejo context for Forgejo pull request triggers, see Forgejo's documentation on webhooks.
Actions
By default, RWX fires the pull request trigger on [opened, synchronize, reopened]. If you only want to handle certain actions, you can specify them:
on:
forgejo:
pull-request:
actions: [opened]
Note that closed is not a default action, as most teams will instead use a
push trigger on the base branch after a
pull request is merged.
See Forgejo's documentation on pull request events for a full list of available actions.