0.19.7 • Published 3 months ago

gitlab-webhook-listener-bot v0.19.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Gitlab WebHook Listener Bot

This project will listen for GitLab webhook events, and do actions based on context.

The project acts as a building block for you to create your own handlers.

Example

This will execute code to re-run renovate bot if the [x] check is checked.

import { main, logger, MergeRequestHandler } from "gitlab-webhook-listener-bot";

class RenovateRebase extends MergeRequestHandler {
  public async handle(payload: MergeRequestPayload): Promise<void> {
    this.logger.debug("Renovate bot wants rebase");
    // TODO: create pipeline
    // code here to do the actual action
  }

  /**
   * Must be an opened mr whose status is updated
   * and branch is renovate branch
   * and rebase checkbox is checked.
   */
  public isValid(payload: MergeRequestPayload): boolean {
    const {
      object_attributes: {
        source_branch,
        action,
        state,
      },
      changes: {
        description,
      },
    } = payload;

    return (
      state === "opened" &&
      action === "update" &&
      source_branch.startsWith("renovate/") &&
      (description?.current || "").includes("[x] <!-- rebase-check -->")
    );
  }
}

main({
  logger,
  handlers: [
    new RenovateRebase(logger),
  ],
});

Demo

There's standalone project that you can copy and start your own project from it:

Similar projects

0.19.7

3 months ago

0.19.6

10 months ago

0.19.5

1 year ago

0.19.1

1 year ago

0.19.2

1 year ago

0.19.3

1 year ago

0.19.4

1 year ago

0.18.5

1 year ago

0.18.6

1 year ago

0.18.3

1 year ago

0.18.1

1 year ago

0.18.2

1 year ago

0.18.0

1 year ago

0.17.0

1 year ago

0.17.1

1 year ago

0.16.2

1 year ago

0.16.0

1 year ago

0.16.1

1 year ago

0.15.0

2 years ago

0.15.1

2 years ago

0.14.2

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.10.3

2 years ago

0.13.1

2 years ago

0.13.2

2 years ago

0.13.3

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.10.0

2 years ago

0.3.0

2 years ago

0.9.0

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.5.0

2 years ago

0.2.3

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.2

2 years ago

0.7.0

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.2.1

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago