flakeUpdate

flakeUpdate :: AttrSet → Effect

An effect that checks out a repository, updates the flake.nix file, creates a branch, creates a PR if there are changes.

The flake-parts module is the recommended method for using this function, whereas flakeUpdate itself may be useful for advanced use cases.

The parameters generally match up with the hercules-ci.flake-update options.

Example

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

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; };
  onSchedule.update = {
    outputs = {
      effects = {
        update = effects.flakeUpdate {
          gitRemote = primaryRepo.remoteHttpUrl;
          # tokenSecret = { type = "GitToken"; };
          createPullRequest = true;
          autoMergeMethod = "merge";
        };
      };
    };
    when = {
      dayOfWeek = [ "Mon" "Wed" ];
      hour = [ 0 ];
    };
  };
};