Git-related Modules

Module git-auth

The module provides the basics for working with a git repository.

Example import:

hci-effects.modularEffect {
  imports = [
    hci-effects.modules.git-auth
  ];
}

git​.checkout​.forgeType

The forge type according to Hercules CI​.

Valid values include "github" and "gitlab", or you could forward this from herculesCI​.repo​.forgeType (flake-parts) or the metadata passed to the herculesCI function: primaryRepo​.forgeType​.

Type: string

Example:

primaryRepo.forgeType

Declared by:

git​.checkout​.remote​.url

The git remote URL​. Currently only http/https URLs are supported​.

The current repo URL is available in herculesCI​.repo​.remoteHttpUrl or the metadata passed to the herculesCI function: primaryRepo​.remoteHttpUrl​.

Type: string

Example:

primaryRepo.remoteHttpUrl

Declared by:

git​.checkout​.tokenSecret

Name of the secret that contains the git token​.

Type: string

Default:

"token"

Declared by:

git​.checkout​.user

User name for authentication with the git remote​.

Type: string

Default:

"git"

Declared by:

Module git-update

A module that facilitates the updating of a git repository.

Example import:

hci-effects.modularEffect {
  imports = [
    hci-effects.modules.git-update
  ];
}

git​.update​.baseBranch

Branch name on the remote that the update branch will be

  • based on (via git​.update​.baseMerge​.branch), and

  • merged back into (via git​.update​.pullRequest​.base) if enabled​.

"HEAD" refers to the default branch, which is often main or master​.

Type: string

Default:

"HEAD"

Declared by:

git​.update​.baseMerge​.enable

Whether to update an existing update branch with changes from the base branch before running git​.update​.script​.

This option only applies when the update branch already exists from a previous run​. The existing branch is likely stale, so enabling this ensures it includes recent changes from the base branch​.

If disabled and the update branch exists, the update script will run from the branch’s current state, which may be missing recent changes from the base branch​.

Type: boolean

Default:

false

Declared by:

git​.update​.baseMerge​.branch

Branch name on the remote to update the existing update branch from​.

Typically this should be the same as the target branch for pull requests​. Used when git​.update​.baseMerge​.enable is true and the update branch exists​.

Type: string

Default:

git.update.baseBranch

Declared by:

git​.update​.baseMerge​.method

How to update an existing update branch with changes from the base branch​.

  • "merge": Create a merge commit, preserving both branch histories​. Safe but creates additional merge commits in the update branch​.

  • "rebase": Rebase existing update branch commits onto the current base branch​. Creates a linear history but rewrites commit hashes (requires force push)​.

  • "fast-forward": Only proceed if the update branch can fast-forward to the base branch​. Fails if the update branch has any commits not present in the base branch​. This is the most conservative option, preventing complex merge scenarios​.

  • "reset": Always discard the existing update branch and start fresh from the base branch​. This treats the update branch as fully regeneratable from the update script​. Useful for automated updates (like flake​.lock) where the update script output is deterministic and conflicts should be resolved by regenerating​. Any manual changes to the update branch will be lost​.

The "fast-forward" method is recommended for automated workflows where you prefer explicit failures over automatic conflict resolution​.

Used when git​.update​.baseMerge​.enable is true and the update branch exists​.

Type: one of “merge”, “rebase”, “fast-forward”, “reset”

Default:

"merge"

Declared by:

git​.update​.branch

Branch name to push to​.

If you use pull requests, this should be a “feature” branch​.

Type: string

Declared by:

git​.update​.pullRequest​.enable

Whether to create a pull request to merge the updated branch into the default branch​.

Type: boolean

Default:

true

Declared by:

git​.update​.pullRequest​.autoMergeMethod

Whether to enable auto-merge on new pull requests, and how to merge it​.

This requires GitHub branch protection to be configured for the repository​.

Type: one of ​<​null>, “merge”, “rebase”, “squash”

Default:

null

Declared by:

git​.update​.pullRequest​.base

Branch name on the remote to merge the update branch into​.

Used when git​.update​.pullRequest​.enable is true​.

Type: string

Default:

git.update.baseBranch

Example:

"develop"

Declared by:

git​.update​.pullRequest​.body

The body, or description, of the pull request​.

A more detailed body can be achieved by making git​.update​.script set the body contents in the HCI_GIT_UPDATE_PR_BODY environment variable​.

If null, the body will be empty or automatic based on the commit message​.

Type: null or string

Declared by:

git​.update​.pullRequest​.title

The title to use for the pull request​.

A more detailed title can be achieved by making git​.update​.script set the title in the HCI_GIT_UPDATE_PR_TITLE environment variable​.

Type: string

Declared by:

git​.update​.script

Bash statements that create zero or more commits​. All changes must be explicitly committed by the script​.

The working directory is the root of the checkout​.

Type: strings concatenated with “\n”

Declared by:

See also