Repo: Checkout action.

An action to checkout/clone your repo in your workflow. Almost all workflows will use this.

Samples

Basic

steps:
  - name: πŸ›Ž Checkout
    uses: actions/checkout@v2

Fetch depth

You can customize it like this:

steps:
  - name: πŸ›Ž Checkout
    uses: actions/checkout@v2
    with:
      fetch-depth: 0

That will do a shallow clone to fetch only one commit, so is more efficient.

Tokens

You can prevent your credentials from being persisted across multiple commands within the workflow.

You already get GitHub auth token removed as part of post-job cleanup. So either way, your details are not persisted after the job run. I’ve seen this param recommended to set to avoid persisting after the job, but I don’t think that can happen anyway.

From the docs:

The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set persist-credentials: false to opt-out.

persist-credentials - Whether to configure the token or SSH key with the local git config

steps:
  - name: Checkout πŸ›ŽοΈ
    uses: actions/checkout@v2
    with:
      persist-credentials: false

Submodules

If you use submodules, do this to ensure those are filled.

Equivalent too git clone --recursive.

Note also the fetch-depth is limited, so only the one commit is fetched for the submodule, as well as the root repo.

steps:
  - name: Checkout πŸ›ŽοΈ
    uses: actions/checkout@v2
    with:
      submodules: true
      fetch-depth: 0