GitHub workflow
The GitHub backend allows you to trigger GitHub workflows for your self-service actions and automations, using Port's GitHub application.
The GitHub backend is available for both the standard Port GitHub app, and the self-hosted version.
The steps shown in the image above are as follows:
- Port publishes an invoked
action
message to a topic. - A secure topic (
ORG_ID.github.runs
) holds all the action invocations. - A listener implemented in Port's GitHub application receives the new topic message and runs the GitHub workflow defined by the creator of the self-service action/automation.
An example flow would be:
- A developer asks to deploy a new version of an existing
Microservice
, using a self-service action. - The
create
action is sent to thegithub.runs
topic. - Port's GitHub application event handler is triggered by this new action message.
- Port's GitHub application triggers the GitHub workflow that deploys a new version of the service.
- As part of the workflow, the new microservice
Deployment
is reported back to Port. - When the workflow is done, Port's GitHub application reports back to Port about the status of the action run (
SUCCESS
orFAILURE
), according to workflow's status.
A workflow triggered using the workflow_dispatch
trigger is self-contained. This means its actions and effects over the repository cannot trigger other automatic workflows.
- A developer invokes a "provision new microservice in monorepo" workflow.
- The workflow opens a new PR in the target repository based on a pre-defined template.
- The repository also has a workflow which is automatically triggered using the
on: pull_request: types: "opened"
trigger. - In this instance, the automatic PR workflow will not be triggered.
Configurationโ
When using this backend, you need to provide the GitHub organization and repository where the workflow is located, as well as the workflow name.
The workflow must reside in the repository's .github/workflows/
directory.
Specify a branchโ
By default, the integration will look for the workflow in the main
branch of the repository.
To use a different branch, simply pass the ref
key in the Configure the invocation payload
section (or workflowInputs
in the JSON object) with the desired branch name as the value:
{
"ref": "my-branch-name"
}
Automatic workflow status updateโ
Additionally, you can define whether or not Port should automatically use the workflow's end status (SUCCESS
/FAILURE
) to update the action/automation status in Port.
By default, this is set to true
. To disable this option, set the reportWorkflowStatus
field to true
in the invocationMethod
object, or set the Report workflow status
option to No
if using the UI.
Examplesโ
For complete examples of self-service actions using a GitHub workflow as the backend, check out the guides section.