Branches and PRs¶
Branch model¶
The repository has two long-lived branches:
| Branch | Purpose |
|---|---|
dev |
The integration branch. All feature branches merge into dev. |
main |
The release branch. It changes only through a dev → main PR or a release PR. |
A change moves through these steps:
flowchart LR
F["feature branch"] -->|PR| D["dev"]
D -->|"PR, squash"| M["main"]
M -->|release-please| R["release PR"]
R -->|squash| M2["main + tag vX.Y.Z"]
M2 -->|merge| D2["dev"]
- Create a feature branch from
dev. - Open a PR from the feature branch to
dev. - Merge the PR into
devwhen all checks pass. - To release, open a PR from
devtomain. Squash-merge it. - Release-please opens a release PR on
main. Merge it to create thevX.Y.Zgit tag. - Merge
mainback intodev.
Steps 4 to 6 are in the Release procedure.
Feature branches¶
- Give the branch a short name with a type prefix:
feat/,fix/,docs/,ci/orchore/. Add the issue number when there is one, for examplefix/20-21-lint-format. - Write commit messages as Conventional Commits. Release-please reads them to select the next version and to write the changelog.
- Refer to the issue in the commit message, for example
Refs #37. - Do not commit directly to
main.
PRs to dev¶
These workflows run on a PR to dev:
lint.yml, test.yml (job smoke), container-check.yml, and build-3t-seq.yml when the Dockerfile changes.
The CI reference gives the details.
dev has no ruleset. GitHub does not block a merge into dev when a check fails.
Do not merge a PR into dev until all checks pass.
A failure on dev also blocks the next dev → main PR.
Fork PRs¶
A fork PR has two limits:
- Approval to run CI. The repository setting is "Require approval for first-time contributors". A maintainer must approve the workflow runs of a first-time contributor.
- No images.
build-3t-seq.ymlskips fork PRs.build-salmonte.ymlbuilds only for release PRs from this repository. A fork cannot push images toghcr.io/boulardlab.
When a fork PR changes a conda env, the image for the new env hash does not exist.
Thus, the check job fails. To build the image, a maintainer does these steps:
- Push the fork branch to a branch in
boulardlab/3t-seq. - Run
gh workflow run build-3t-seq.yml --ref <branch>. - Wait for the build to finish.
- Run the failed
checkjob of the fork PR again.
Alternatively, open a PR to dev from the branch in boulardlab/3t-seq.
That PR builds the image itself.
Ruleset for main¶
The ruleset main: release gate protects main. It has these rules:
| Rule | Value |
|---|---|
| Target | The default branch (main) |
| Required checks | check, dockerfile-sync, smoke |
| Branch must be up to date | Yes (strict). The PR must contain the latest main. |
| Required approvals | 1 |
| Stale approvals | A new push to the PR removes the approvals. |
| Allowed merge methods | Squash and rebase. Merge commits are not allowed. |
| Branch deletion and force push | Blocked |
| Bypass | Repository admins, always |
To read the current rules, run:
Consequences¶
- Squash
dev→main.devcontains merge commits. GitHub cannot rebase-merge a PR with merge commits, so squash is the only method for this PR. - One commit, one changelog entry. Release-please sees the squash commit as one change. Put the release notes in the release PR. See Release procedure.
- Force the version with a footer. End the squash commit message with
Release-As: X.Y.Z. Release-please then proposes versionX.Y.Z. - Approve from a different account. GitHub does not let the author of a PR approve it. Ask a second maintainer to approve. Alternatively, an admin can bypass the rule.
- Update before approval. Update the branch first, then ask for approval. An update is a push, so it removes the approvals.