Configuration Hooks

All of the following hooks in some way deal with detecting, modifying and validating auto's configuration.


Happens before any command is run. This is a great place to check for platform specific secrets such as a npm token.

auto.hooks.beforeRun.tapPromise("NPM", async (config) => {
  if (!process.env.NPM_TOKEN) {
    auto.logger.log.warn("NPM Token is needed for the NPM plugin!");


Modify what is in the config. You must return the config in this hook. If you plugins requires some option to be set this is the place to do it.

auto.hooks.modifyConfig.tap("test", (config) => {
  config.labels.released = {
    name: "released",
    description: "This issue/pull request has been released",

  return config;

Other examples:

  • cocoapods - Sets noVersionPrefix to true for independent monorepos
  • npm - Sets noVersionPrefix to true for independent monorepos
  • release - Adds released label


Get git author to commit with. Typically from a package distribution description file.

auto.hooks.getAuthor.tapPromise("NPM", async () => {
  const { author } = JSON.parse(await readFile("package.json", "utf-8"));

  if (author) {
    return author;


Get the previous version. Typically from a package distribution description file. This hooks is required for plugin that facilitate publishing.

auto.hooks.getPreviousVersion.tapPromise("NPM", async () => {
  const { version } = JSON.parse(await readFile("package.json", "utf-8"));

  if (version) {
    return auto.prefixRelease(
      JSON.parse(await readFile("package.json", "utf-8")).version


Get owner and repository for the project to automate releases for. Typically from a package distribution description file. Falls back to global git config author.

auto.hooks.getRepository.tapPromise('NPM', async () => {
  const owner = // get the owner from package.json
  const repo = // get the repo from package.json

  return {


Validate how your plugin is configured. Make sure to account for the different ways you plugin can be included in an .autorc.

auto.hooks.validateConfig.tapPromise("test", (name, options) => {
  if (name === || name === `auto-plugin-${}`) {
    return; // your validation error. Can either be strings for { path, expectedType, value }

auto and it's plugins use io-ts to validate the options for a plugin. If you're using typescript this is a great way to define the options for your plugin.

// Types in TypeScript
interface Options {
  level?: string;
  user?: string;

// The equivalent io-ts code
import * as t from "io-ts";

const pluginOptions = t.partial({
  level: t.string,
  user: t.string,

export type Options = t.TypeOf<typeof pluginOptions>;

Since your type information will now be available at runtime (in pluginOptions) you can use this to validate the configuration! To do this auto exposes a helper function to validate you plugins with the io-ts types.

import { validatePluginConfiguration } from "@auto-it/core";

auto.hooks.validateConfig.tapPromise("test", (name, options) => {
  if (name === || name === `auto-plugin-${}`) {
    return validatePluginConfiguration(, pluginOptions, options);