ci: Disable redundant CI on main branch merges (#386)

## Summary

- Split CI workflow to stop re-running validation when PRs are merged to
main
- Create dedicated `release.yml` workflow for Docker Hub releases on
main branch
- Keep full CI validation for PRs and `perm-*` branches

## Motivation

Since the repository is configured to:
1. Require PRs to be up-to-date with main before merging
2. Require all CI checks to pass

Re-running the full CI suite (~12 jobs) on main after merge is redundant
and wastes CI runner time that could be used for other tasks.

## Changes

| Workflow | Before | After |
|----------|--------|-------|
| `CI.yml` | Triggers on push to `main`, `perm-*`, and PRs to `main` |
Triggers on push to `perm-*` and PRs to `main` only |
| `release.yml` | N/A (new) | Triggers on push to `main`, runs only
`docker-build-release` |

## Impact

| Event | Before | After | Savings |
|-------|--------|-------|---------|
| PR to main | 13 jobs | 12 jobs | 1 job |
| Merge to main | 13 jobs | 1 job | 12 jobs |
| Push to perm-* | 13 jobs | 12 jobs | 1 job |

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Degosserie 2026-01-09 16:29:59 +01:00 committed by GitHub
parent 9be1acc97e
commit 2557a192c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 8 deletions

View file

@ -1,4 +1,7 @@
#! Main CI Specification for DataHaven Repository
#!
#! This workflow runs validation checks on pull requests.
#! For main branch releases, see release.yml
name: CI
@ -6,7 +9,6 @@ on:
workflow_dispatch:
push:
branches:
- main
- perm-*
pull_request:
branches: [main]
@ -60,13 +62,6 @@ jobs:
with:
binary-hash: ${{ needs.build-operator.outputs.binary-hash }}
docker-build-release:
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/task-docker-release.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
moonwall-tests:
needs: [build-operator]
uses: ./.github/workflows/task-moonwall-tests.yml

31
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,31 @@
#! Release workflow for DataHaven Repository
#!
#! This workflow runs when code is merged to main, publishing Docker images
#! to Docker Hub. Validation checks are handled by CI.yml on pull requests.
#!
#! Since PRs require:
#! 1. Branch to be up-to-date with main before merging
#! 2. All CI checks to pass
#! Re-running validation on main would be redundant.
name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker-build-release:
uses: ./.github/workflows/task-docker-release.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}