`glab ci status` fails for an MR branch, when `Merged Results Pipelines` are enabled
Description
When running glab ci status without an argument for a branch that has an open merge request, the command fails saying there are no pipelines for the current branch.
Expected Behavior vs Actual Behavior
As a user, I would expect glab ci status to check for any open merge requests for the current branch. It would appear that the ref names are incorrectly compared. For example I have a branch named XYZ-123 but the output of glab ci list shows this as refs/merge-requests/1234/merge, explicitly referring to the merge request pipeline, not the branch name.
Possible Fix
If there is no pipeline for the current branch name, try to find an open merge request for the branch and check that instead.
Steps to Reproduce
- Create a branch on a repo that is configured for merge request pipelines:
git checkout -b my_branch - Make a modification
-
git add,git commit, andgit push - Open a new merge request for your branch against the upstream repo and wait for the merge request pipeline to start
- While still operating in the checked out branch in your terminal, run
glab ci statuswhich will fail - Run
glab ci listand take note of the different ref corresponding to the merge request number - Run
glab ci status -b REF_OF_MERGE_REQUESTand notice the correct output
Logs
See steps to reproduce
Your Environment
- MacOS Monterey 12.1, AMD64
- glab version 1.22.0 (2022-01-10)
- git version 2.36.1
- tmux 3.2
- iterm2 3.4.15
Implementation plan
Similar fix required as in !1419 (merged)