Use this GitHub Action (GHA) to create, update, and remove labels on existing artifacts in the CloudBees platform. To learn more about organizing your artifacts using labels, refer to Artifact labels.
Prerequisites
Set up the CloudBees platform and GHA to work together, providing key features of the platform to GHA workflows. Refer to Getting started for more information.
Inputs
Input name | Data type | Required? | Description |
---|---|---|---|
|
String |
Yes |
The identifier of the artifact in the CloudBees platform.[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 platform 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:
steps: - name: Revise artifact labeling uses: cloudbees-io-gha/label-artifact-version@v1 with: artifact-id: "1234abcd-56ef-78gh-90ij-klmnop123456" labels: "For Production,Testing Passed"
Removing labels
In the following example, an artifact 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-78gh-90ij-klmnop123456" 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 platform.
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 the platform.