Use this GitHub Action (GHA) to create, update, and remove labels on existing artifact versions in the CloudBees Unify. To learn more about organizing your artifacts using labels, refer to Artifact labels.
Prerequisites
Set up CloudBees Unify and GHA to work together, providing key features of CloudBees Unify to GHA workflows. Refer to Getting started for more information.
Inputs
| Input name | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The identifier of the artifact version in the CloudBees Unify.[1] |
|
String |
Yes |
A comma-separated list of artifact labels. |
|
String |
No |
The labeling activity to be performed. The following options are valid:
|
|
String |
No |
The CloudBees Unify URL.
The default value is |
Obtain the multi-hexadecimal artifact ID from the output of running the Register build artifact action in a GHA workflow.
Usage examples
Basic example
The following basic example adds the labels For Production and Testing Passed to an existing artifact version:
steps: - name: Revise artifact labeling uses: cloudbees-io-gha/label-artifact-version@v1 with: artifact-id: "1234abcd-56ef-7812-90ab-1234abcd3456" labels: "For Production,Testing Passed"
Removing labels
In the following example, an artifact version has three labels, Label1, Label2, and Label3.
Invoking the action removes the Label2 and Label3 labels, so that the artifact remains labeled only with Label1.
steps: - name: Label an artifact uses: cloudbees-io-gha/label-artifact-version@v1 with: artifact-id: "1234abcd-56ef-78ab-90cd-abc123123456" labels: "Label2,Label3" operation: REMOVE
Updating labels
The following GHA workflow example uses this action to register an artifact and then update its labels in the CloudBees Unify.
Example GHA workflow YAML file
After the run has completed, the artifact label is updated from "For testing" to "For production" for the given artifact version, and the label is displayed in the Artifacts list tab in CloudBees Unify.