Interview Prep/GitHub Actions/Workflow Anatomy & Execution Model

What does `actions/checkout` do by default, and what are the common options?

BeginnerConceptWorkflow Anatomy & Execution Model
Answer

It clones the repo at GITHUB_SHA into $GITHUB_WORKSPACE, shallowly (fetch-depth: 1), and persists the GITHUB_TOKEN into the local git config so later git push works. Common options:

- uses: actions/checkout@v4
  with:
    fetch-depth: 0              # full history (tags, git describe, changelogs)
    ref: ${{ github.event.pull_request.head.sha }}
    persist-credentials: false  # do not leave the token in .git/config
    submodules: recursive
    sparse-checkout: services/api
    lfs: true

Set persist-credentials: false unless a later step really needs to push.

All GitHub Actions questions Roadmap: GitHub Actions

More on Workflow Anatomy & Execution Model