Clone Git Repository

Action ID: git:clone
NPM Package:

@mdude2314/backstage-plugin-scaffolder-git-actions

Description

Clones a Git repository to create a local copy for development or modification.

Input Schema

PropertyTypeDescriptionRequired
argsarray-
repoUrlstringThe repository to clone

Output Schema

No output schema defined for this action.

Usage Examples

Clone a specific branch with shallow history into a subdirectory

Clone a repository branch with a shallow history and place it under a nested path in the workspace. Use this after fetch:template to pull in service source code.

Copy
steps:
  - id: fetch-skeleton
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.name }}

  - id: clone-service
    action: git:clone
    input:
      repoUrl: ${{ parameters.sourceRepoUrl }}
      args:
        - --branch
        - ${{ parameters.branch }}
        - --depth
        - '1'
        - --single-branch
        - services/api

Clone an SSH repo with submodules at a tagged release

Clone an SSH repository with submodules initialized and checked out at a specific tag. Use this to vendor third party modules into a local directory.

Copy
steps:
  - id: clone-vendor-modules
    action: git:clone
    input:
      repoUrl: git@github.com:acme/terraform-modules.git
      args:
        - --recurse-submodules
        - --shallow-submodules
        - --branch
        - ${{ parameters.tag }}
        - vendor/terraform-modules

  - id: fetch-app
    action: fetch:template
    input:
      url: ./app
      targetPath: .
      values:
        appId: ${{ parameters.appId }}