Skip to content

fix(ci run): use correct default branch

Christoper requested to merge christoper.hans/cli:fix-ci-run-correct-branch into main

Description

glab ci run does not pick correct git branch - This MR is to fix and ensure glab ci run is running against current branch if no branch parameter set

Related Issues

Relates to #1380 (closed)

How has this been tested?

  1. Create a sample GitLab repo which contain more than 1 branch at https://gitlab.com/christoper.hans/glab-ci-test-branch
  2. Sample .gitlab-ci.yml returns current branch (Reference: https://gitlab.com/christoper.hans/glab-ci-test-branch/-/blob/main/.gitlab-ci.yml#L7, also see screenshot (1))
  3. Using this sample, glab ci run will result in job printing current branch name
  4. Checkout to test-branch and run glab ci run locally (screenshot (2))
  5. Check created pipeline at https://gitlab.com/christoper.hans/glab-ci-test-branch/-/pipelines/936264344 , resulting job shows current branch as test-run (screenshot (3) and (4))

Screenshots (if appropriate):

  1. image
  2. image
  3. image
  4. image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap

Merge request reports