actions / actions/checkout

checkout@v2 doesn't allow `git diff origin/master`

Open
#438 8 comments 7 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

Hi, I have such a step in my actions config:

    name: Get list of changed files
    id: changed_files
    run: |
        list=`git diff --name-only origin/master HEAD`
        echo $list
        echo "::set-output name=list::$list"
    shell: bash

When using checkout@v1 it works, while with checkout@v2 I get

fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.

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

Reproduce the checkout@v2 workflow using the shown action configuration, then run the reported git diff --name-only origin/master HEAD command in the checked-out workspace. Trace how checkout@v2 fetches and names refs, and verify the fix by confirming that origin/master resolves and the command lists changed files.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.