actions / actions/checkout

Question about fetch depth

Open
#477 2 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.9k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

I think this is just me not able to understand the full problem, if so please feel free to close the issue.

The easiest way I figured out to replicate my issue is via git diff, even if I have a program that does that + more logic.

This is what I want to execute:

git diff "origin/$GITHUB_HEAD_REF..origin/$GITHUB_BASE_REF

It is always empty, even if the checkout action has fetch-depth set to 0.

    - name: Checkout code
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

I had to manually fetch the origin git fetch origin in order to get git diff working as I want. Is it all expected and I am just missing something huge?

Thanks a lot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported git diff "origin/$GITHUB_HEAD_REF..origin/$GITHUB_BASE_REF" command with actions/checkout@v2 and fetch-depth: 0. Inspect which refs are available after checkout and compare them with the result after git fetch origin; done means documenting the expected behavior or identifying a focused change.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.