Skip to content

ci: trigger GitLab pipeline only for branches with open PR - #1861

Merged
gytsto merged 3 commits into
mainfrom
ci-gate-gitlab-trigger-on-open-pr
Jul 7, 2026
Merged

ci: trigger GitLab pipeline only for branches with open PR#1861
gytsto merged 3 commits into
mainfrom
ci-gate-gitlab-trigger-on-open-pr

Conversation

@gytsto

@gytsto gytsto commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Every branch push triggers the full internal GitLab pipeline (all builds + 9 parallel natlab shards) even when the branch has no PR — WIP pushes consume constrained natlab runner slots and queue reviewed work for hours.

Solution

Gate the push-event trigger on an open PR for the branch (check-branch-has-pr job, gh api pulls?head=). main, release/**, merge-queue and labeled events trigger unconditionally. To get CI on a WIP branch, open a draft PR.

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

Comment thread .github/workflows/gitlab.yml Outdated
@gytsto
gytsto requested a review from a team as a code owner July 2, 2026 10:54
@gytsto
gytsto force-pushed the ci-gate-gitlab-trigger-on-open-pr branch from 8821bef to 6660da6 Compare July 2, 2026 11:17
@asledzinskiy

Copy link
Copy Markdown
Contributor

+1

gytsto added 3 commits July 7, 2026 09:54
Every branch push runs the full codehub pipeline (builds + 9 natlab
shards) even with no PR open, taking runner slots from reviewed work.
Open a (draft) PR to get CI on a branch; main and release/** still
trigger unconditionally.
Picks up the fix cancelling outdated queued (pending/created)
pipelines, not only running ones.
@gytsto
gytsto force-pushed the ci-gate-gitlab-trigger-on-open-pr branch from 6660da6 to 6aba42c Compare July 7, 2026 06:57
@olekoliinyk

Copy link
Copy Markdown
Contributor

+1.0

@gytsto
gytsto enabled auto-merge July 7, 2026 09:24
@gytsto
gytsto added this pull request to the merge queue Jul 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@gytsto
gytsto added this pull request to the merge queue Jul 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@gytsto
gytsto added this pull request to the merge queue Jul 7, 2026
Merged via the queue into main with commit 7fdd42d Jul 7, 2026
62 checks passed
@gytsto
gytsto deleted the ci-gate-gitlab-trigger-on-open-pr branch July 7, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants