Skip to main content

Check out Port for yourselfย 

GitHub Workflow

Port's GitHub action allows you to create/update and query entities in Port directly from your GitHub workflows.

Github Illustration
public repository

The GitHub action is open source - see the repository here.

๐Ÿ’ก Common Github workflow usageโ€‹

Port's GitHub action provides a native way to integrate Port with your GitHub workflows, for example:

  • Report the status of a running CI job.
  • Update the software catalog about a new build version for a microservice.
  • Get existing entities.

Usageโ€‹

To use Port's GitHub action, add the following line as a step in your GitHub workflow:

- uses: port-labs/port-github-action@v1

Add your Port CLIENT_ID and CLIENT_SECRET as GitHub secrets in the relevant repository.

Configurationโ€‹

Port's GitHub action supports the following operations:

  • Create/Update catalog entities - invoked with the UPSERT operation, receives the identifier and other properties of a new entity or an entity that needs to be updated.

  • Bulk Create/Update catalog entities - invoked with the BULK_UPSERT operation, receives the entities definitions of some new entities or entities that needs to be updated.

  • Get catalog entities - invoked with the GET operation, receives the identifier of an existing entity and retrieves it for use in your CI.

  • Search catalog entities - invoked with the SEARCH operation, receives a query and retrieves the entities for use in your CI.

  • Delete catalog entities - invoked with the DELETE operation, receives the identifier of an existing entity and deletes it.

  • Update a running action - invoked with the PATCH_RUN operation, receives the identifier of an existing action run along with other properties of the run that need to be updated.

  • Create an action run - invoked with the CREATE_RUN operation, receives the identifier of an existing blueprint, action and entity (optional), along with input properties to run the action with.

- uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.CLIENT_ID }}
clientSecret: ${{ secrets.CLIENT_SECRET }}
baseUrl: https://api.getport.io
operation: UPSERT
identifier: myEntity
icon: myIcon
blueprint: myBlueprint
team: "['myTeam']"
properties: |-
{
"myStringProp": "My value",
"myNumberProp": 1,
"myBooleanProp": true,
"myArrayProp": ["myVal1", "myVal2"],
"myObjectProp": {"myKey": "myVal", "myExtraKey": "myExtraVal"}
}
Selecting a Port API URL by account region

The baseUrl, port_region, port.baseUrl, portBaseUrl, port_base_url and OCEAN__PORT__BASE_URL parameters are used to select which instance or Port API will be used.

Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.

Examplesโ€‹

Refer to the examples page for practical examples of Port's GitHub action.