linear-b / gitstream

/:\ gitStream - Workflow automation for your git repo. Use YAML to auto-assign reviewers, auto-merge PRs, automatic PR labeler, and more.
https://gitstream.cm
Apache License 2.0
267 stars 32 forks source link

Evaluate Rules step is failing #559

Closed yakirm-cr closed 2 months ago

yakirm-cr commented 3 months ago

Describe the bug

As of today we started facing the following error in gitStream workflow automation during the Evaluate Rules step:

Run linear-b/gitstream-github-action@v2
Run actions/setup-node@v4
Attempting to download 20.12.2...
Acquiring 20.12.2 - x64 from https://github.com/actions/node-versions/releases/download/20.12.2-8647736879/node-20.12.2-linux-x64.tar.gz
Extracting ...
/usr/bin/tar xz --strip 1 --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/23eb7448-bcb6-451c-a1a9-72f6ca3fab9b -f /home/runner/work/_temp/4fa59221-6f40-4f1d-b463-86da1c1bfd31
Adding to the cache ...
Environment details
Run actions/setup-python@v5
Installed versions
Run rm -rf gitstream && rm -rf code && mkdir gitstream
Run actions/checkout@v4
Syncing repository: ORG/REPO
Getting Git version info
Temporarily overriding HOME='/home/runner/work/_temp/0bdf0e2a-a6a6-4e07-98de-448c8f35b988' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/REPO/REPO/gitstream/repo
Deleting the contents of '/home/runner/work/REPO/REPO/gitstream/repo'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
/usr/bin/git sparse-checkout disable
/usr/bin/git config --local --unset-all extensions.worktreeConfig
Checking out the ref
/usr/bin/git log -1 --format='%H'
'78bc3fec6e75c0020ce4003d355270747eeadc29'
Run actions/github-script@v7
Run ALL=2147483647
From https://github.com/ORG/REPO
 * branch                base_branch       -> FETCH_HEAD
From https://github.com/ORG/REPO
 * branch                head_branch -> FETCH_HEAD
 * [new branch]          head_branch -> upstream/head_branch
Switched to a new branch 'upstream/head_branch'
branch 'upstream/head_branch' set up to track 'upstream/head_branch'.
Switched to branch 'base_branch'
Your branch is up to date with 'origin/base_branch'.
hint: If you meant to check out a remote tracking branch on, e.g. 'origin',
hint: you can do so by fully qualifying the name with the --track option:
hint:
hint:     git checkout --track origin/<name>
hint:
hint: If you'd like to always have checkouts of an ambiguous <name> prefer
hint: one remote, e.g. the 'origin' remote, consider setting
hint: checkout.defaultRemote=origin in your config.
fatal: 'head_branch' matched multiple (2) remote tracking branches
Error: Process completed with exit code 128.

To Reproduce The issue can be reproduced by manually executing the steps inside the Run ALL=2147483647 inner step (in Ubuntu terminal):

  ALL=2147483647
  cd gitstream && cd repo
  git fetch --deepen=$ALL origin $'base_branch'
  git remote add upstream $'https://github.com/ORG/REPO'
  git fetch --deepen=$ALL upstream $'head_branch'
  git checkout -b $'upstream/head_branch' $'upstream/head_branch'
  git checkout $'base_branch'
  git checkout $'head_branch'

Expected behavior The last git checkout command is successful.

vim-zz commented 3 months ago

@yakirm-cr can you share the PR URL?

yakirm-cr commented 2 months ago

@vim-zz For some reason the issue is not reproducible. I am closing the issue.

vim-zz commented 2 months ago

@yakirm-cr we think it's related to a corner case when using forks, could it be the case?

yakirm-cr commented 2 months ago

@vim-zz YES :slightly_smiling_face: You are absolutely right!!! This is encountered in a fork repository.