Skip to content

Unexpected v7 error fatal: ambiguous argument on diff --stat #3311

Open
@fatbasstard

Description

@fatbasstard

Hi,

We've updated to V7 and now getting an (unexpected) error. Checked the "what's new" and changes and it didn't mention anything that could impact, but it did.

Error

Create or update the pull request branch
  /usr/bin/git symbolic-ref HEAD --short
  staging
  Working base is branch 'staging'
  /usr/bin/git checkout --progress -B 0fe2ab1b-5922-4136-bf19-07b126f04ed7 HEAD --
  Switched to a new branch '0fe2ab1b-5922-4136-bf19-07b126f04ed7'
  /usr/bin/git status --porcelain -unormal --
  /usr/bin/git diff --quiet --
  /usr/bin/git diff --quiet --staged --
  /usr/bin/git stash push --include-untracked
  No local changes to save
  Resetting working base branch 'staging'
  /usr/bin/git checkout --progress staging --
  Switched to branch 'staging'
  Your branch and 'origin/staging' have diverged,
  and have 8390 and 1 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)
  /usr/bin/git reset --hard origin/staging
  HEAD is now at 9ddb1d2a Merge pull request #[49](https://github.com/xxx/repository/actions/runs/xxx/job/xxx?pr=4929#step:4:55)26 from xxx/develop
  /usr/bin/git rev-list --right-only --count staging...0fe2ab1b-5922-4136-bf19-07b126f04ed7
  8391
  /usr/bin/git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --force --depth=8401 origin develop:refs/remotes/origin/develop
  remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)        
  Pull request branch 'develop' already exists as remote branch 'origin/develop'
  /usr/bin/git checkout --progress develop --
  Switched to branch 'develop'
  /usr/bin/git rev-list --right-only --count staging...develop
  8391
  /usr/bin/git diff --quiet develop..0fe2ab1b-[59](https://github.com/xxx/repository/actions/runs/xxx/job/xxx?pr=4929#step:4:65)22-4136-bf19-07b126f04ed7
  /usr/bin/git diff --stat develop..develop~8391
  fatal: ambiguous argument 'develop..develop~8391': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  Error: The process '/usr/bin/git' failed with exit code 128

Configuration

---
name: Create Develop to Staging branch Pull Request
on:
push:
  branches:
    - develop
workflow_call:

jobs:
sync-to-staging:
  runs-on: ubuntu-latest
  steps:
    - name: Check out code
      uses: actions/checkout@v4
      with:
        ref: staging
    - name: Reset promotion branch
      run: |
        git fetch origin develop:develop
        git reset --hard develop
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v7.0.0
      with:
        title: Sync (Develop) to Staging
        body: Synchronize all changes from `develop` to `staging`
        branch: develop
        token: ${{ secrets.OUR_CUSTOM_TOKEN }}

In short, we have bunch or repositories which have a DTAP setup (develop->staging->main) where we use branch promotion to push changes to main. So simplify this process we use this action to automatically create a Sync to staging PR with changes from the develop branch.

Works like a charm with 6.1.0, breaks in 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions