Skip to content

Allow to specify default branch in GitLab CI/CD only/except parameters

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

GitLab Pages uses GitLab CI/CD pages task as follows:

pages:
  stage: deploy
  script: ...
  artifacts:
    paths:
    - public
  only:
  - master

If default branch name differs from master (e.g. v0, v1 branch naming common to Go projects), current implementation requires hardcoding default branch name into .gitlab-ci.yml.

Intended users

Developers.

Proposal

Implement special keyword HEAD that uses default branch as CI input:

job_name:
  # ...
  only:
  - HEAD

Links / references

Edited by 🤖 GitLab Bot 🤖