Git clone

swaleio/[email protected]

Git clone

Clones repository_url into the container-local path given by dest and emits the resolved commit_sha for downstream tasks.

Inputs

Input Required Default Description
repository_url yes — HTTPS URL of the repository.
revision no default branch Branch, tag, or full commit SHA to check out.
dest yes — Absolute clone path inside the container. Point it at the mounted workspace (e.g. ${{env.WORKFLOW_STORAGE}}/repo) to share the clone with later tasks, or any other container-local path.
git_token no — Token for private repos (pass a project/account secret).

Outputs

Output Description
commit_sha The resolved HEAD commit SHA.

Revisions

The task clones only the latest commit of what it checks out:

  • revision empty: the repository's default branch.
  • A branch: a local branch of that name, tracking the remote one, as git clone --branch leaves it.
  • A tag: the tagged commit, with no branch checked out.
  • A commit: give its full 40-character SHA. The commit is checked out with no branch.

A shortened SHA, or a branch or tag that does not exist, fails with Remote branch <revision> not found in upstream origin.

Compute

CPU. Data movement only — no GPU is needed, and scheduling it on a GPU compute type wastes money.

Example

name: Git clone example
compute_type: cpu-4
entry_point: main

blocks:
  main:
    tasks:
      checkout:
        name: Checkout
        uses: swaleio/git-clone
        args:
          repository_url: https://github.com/acme/app.git
          revision: v1.4.0
          dest: ${{env.WORKFLOW_STORAGE}}/repo
          git_token: ${{secrets.github_token}}

Downstream tasks read the cloned files at ${{env.WORKFLOW_STORAGE}}/repo and the commit via ${{tasks.checkout.outputs.commit_sha}}.


For the workflow syntax these examples use, see the workflow definition reference in the Swale documentation.

Licensed under the MIT License.