I saw a lot of uses of :
jobs:
myjob:
steps:
- name: checkout
uses: "actions/checkout@something"
- ...
But i can not find what is the purpose of the line :
uses : "actions/checkout@something"
Is it similar to this ?
run: git checkout something
For this line: uses : "actions/checkout@something"
, it will use the actions/checkout
github action (source here) with the ref something
. This ref only refers to the github action version (nothing to do with your repo)
The uses
statement refers to a github action that is being used in this step. From github documentation for jobs.<job_id>.steps[*].uses
:
Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image.
From actions/checkout readme :
This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
By default it checks out only one commit. My understanding is that it's doing something similar to:
git fetch --depth 1 origin $GITHUB_REF
This action also persists an auth token in git config. This way, your workflow can run authenticated git commands
By default, it clones your current repository ({{ github.repository }}
) but you can also use this action to clone a different repository, and specify additionnal parameters like token
, branch
, path
etc...
An example with additionnal input parameters: check out all git history by setting fetch-depth
to 0
(default is 1
), see usage doc:
- uses: actions/checkout@v2
with:
fetch-depth: 0