Trigger CloudBees workflows from GitHub Actions

2 minute read

Use the run-cloudbees-workflow GitHub Action in a GHA workflow to trigger a CloudBees Unify workflow. This action is available on the GitHub Marketplace.

Inputs

Table 1. Input details
Input name Data type Required? Description

cloudbees-pat

String

Yes

The CloudBees Unify personal access token.

workflow-file-name

String

Yes

The filename of the CloudBees Unify workflow YAML file to be run.

cloudbees-url

String

No

The CloudBees Unify URL. The default value is https://api.cloudbees.io.

component-id

String

No

The identifier of the CloudBees Unify component where the workflow to be run resides. If the caller GHA workflow has been onboarded to CloudBees Unify, the default is the component ID of where the caller GHA workflow is located.[1]

branch-name

String

No

The repository code branch of the CloudBees Unify workflow to be run. The default is the same branch as the triggering GHA workflow.

workflow-inputs

JSON

No

Input parameters required to run the CloudBees Unify workflow, formatted as JSON data in key/value pairs.

[1] To find the multi-hexadecimal component UUID:

  1. Navigate to the component in CloudBees Unify.

  2. Locate the ID value in the URL after componentId=.

Output

Table 2. Output details
Output name Data type Description

cbp-run-url

String

The CloudBees Unify URL of the triggered CloudBees workflow run.

Usage examples

The following is a basic example of using the action:

steps: - name: Run CloudBees workflow uses: cloudbees-io-gha/run-cloudbees-workflow@v1 with: cloudbees-pat: ${{ secrets.MY_PAT }} workflow-file-name: "workflow.yaml"

The following example specifies the component ID and branch name:

steps: - name: Run CloudBees workflow main branch uses: cloudbees-io-gha/run-cloudbees-workflow@v1 with: cloudbees-pat: ${{ secrets.MY_PAT }} workflow-file-name: "workflow.yaml" component-id: "1234abcd-56ef-78gh-90ij-123456klmnop" branch-name: "main"

The following example specifies input parameters:

steps: - name: Run CloudBees workflow main branch uses: cloudbees-io-gha/run-cloudbees-workflow@v1 with: cloudbees-pat: ${{ secrets.MY_PAT }} workflow-file-name: "workflow.yaml" workflow-inputs: '{"workflowInput1": "test1","workflowInput2": "test2"}'