GitLab · Arazzo Workflow

GitLab Add and Preview a Project Badge

Version 1.0.0

Render a badge preview, then add it to a project and confirm the list.

1 workflow 1 source API 1 provider
View Spec View on GitHub CodePlatformSoftware DevelopmentSource ControlArazzoWorkflows

Provider

gitlab

Workflows

add-project-badge
Preview, add, and confirm a project badge.
Previews the badge render, creates the badge on the project, then lists project badges to verify it exists.
3 steps inputs: imageUrl, linkUrl, name, privateToken, projectId outputs: badgeId, badgeName
1
previewBadge
getApiV4ProjectsIdBadgesRender
Render a preview of the badge link and image before persisting it.
2
addBadge
postApiV4ProjectsIdBadges
Add the badge to the project.
3
confirmBadges
getApiV4ProjectsIdBadges
List the project badges to confirm the new badge is present.

Source API Descriptions

Arazzo Workflow Specification

gitlab-add-project-badge-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: GitLab Add and Preview a Project Badge
  summary: Render a badge preview, then add it to a project and confirm the list.
  description: >-
    A project badge provisioning flow. The workflow first renders a preview of
    the badge link and image, adds the badge to the project, and then lists the
    project badges to confirm it was persisted. Every step spells out its request
    inline so the flow can be read and executed without opening the underlying
    OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: gitlabProjectsApi
  url: ../openapi/gitlab-api-v4-projects-openapi-original.yml
  type: openapi
workflows:
- workflowId: add-project-badge
  summary: Preview, add, and confirm a project badge.
  description: >-
    Previews the badge render, creates the badge on the project, then lists
    project badges to verify it exists.
  inputs:
    type: object
    required:
    - privateToken
    - projectId
    - linkUrl
    - imageUrl
    properties:
      privateToken:
        type: string
        description: GitLab Private-Token used to authenticate the API calls.
      projectId:
        type: string
        description: The ID or URL-encoded path of the project.
      linkUrl:
        type: string
        description: URL of the badge link.
      imageUrl:
        type: string
        description: URL of the badge image.
      name:
        type: string
        description: Name for the badge.
        default: pipeline
  steps:
  - stepId: previewBadge
    description: Render a preview of the badge link and image before persisting it.
    operationId: getApiV4ProjectsIdBadgesRender
    parameters:
    - name: Private-Token
      in: header
      value: $inputs.privateToken
    - name: id
      in: path
      value: $inputs.projectId
    - name: link_url
      in: query
      value: $inputs.linkUrl
    - name: image_url
      in: query
      value: $inputs.imageUrl
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      renderedImageUrl: $response.body#/rendered_image_url
  - stepId: addBadge
    description: Add the badge to the project.
    operationId: postApiV4ProjectsIdBadges
    parameters:
    - name: Private-Token
      in: header
      value: $inputs.privateToken
    - name: id
      in: path
      value: $inputs.projectId
    requestBody:
      contentType: application/json
      payload:
        link_url: $inputs.linkUrl
        image_url: $inputs.imageUrl
        name: $inputs.name
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      badgeId: $response.body#/id
      badgeName: $response.body#/name
  - stepId: confirmBadges
    description: List the project badges to confirm the new badge is present.
    operationId: getApiV4ProjectsIdBadges
    parameters:
    - name: Private-Token
      in: header
      value: $inputs.privateToken
    - name: id
      in: path
      value: $inputs.projectId
    - name: name
      in: query
      value: $inputs.name
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      firstBadgeId: $response.body#/0/id
  outputs:
    badgeId: $steps.addBadge.outputs.badgeId
    badgeName: $steps.addBadge.outputs.badgeName