gitWriteBranch

gitWriteBranch :: Module → Effect

A modularEffect effect that checks out a repository, replaces a contents and pushes to a branch. Optionally, it can create a pull request.

Example

Here’s an example of the herculesCI attribute for a non-flake-parts project.

let hci-effects = hercules-ci-effects.lib.withPkgs pkgs;
in
# ...
herculesCI = { branch, primaryRepo, ... }: {
  # If you're switching from a nix-build style job configuration, you'll need
  # to define `onPush.default.outputs` to substitute for the old behavior.
  # It is traversed more eagerly, so large structures may need `dontRecurseIntoAttrs`.
  # onPush.default.outputs = { inherit mypkg; };
  onPush.doc-branch = {
    # Branch for which the effect is triggered
    enable = branch == "master";
    outputs = {
      effects = {
        update = hci-effects.gitWriteBranch {
          git.checkout.remote.url = primaryRepo.remoteHttpUrl;
          git.checkout.forgeType = "github";
          git.checkout.user = "x-access-token";
          # Branch to write to
          git.update.branch = "doc";
          contents = self.packages.x86_64-linux.doc-branch-contents
        };
      };
    };
  };
};

Effect Options

allowExecutableFiles

Whether executable files are allowed. If not, these permission bits will be omitted when copying the contents.

Type: boolean

Default: true

Declared by:

contents

The contents to which the branch will be set.

The basename of contents will not be used.

Type: path

Declared by:

destination

Relative path into repository that will be replaced by the contents.

Any pre-existing contents at this location will be removed.

Type: string

Default: "."

Declared by:

message

Commit message for the updated contents.

Type: string

Default: "Update " + the destination or git.update.branch

Declared by: