0.19.4 • Published 2 months ago

gitlab-webhook-listener-bot v0.19.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 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.1

2 months ago

0.19.2

2 months ago

0.19.3

2 months ago

0.19.4

2 months ago

0.18.5

2 months ago

0.18.6

2 months ago

0.18.3

3 months ago

0.18.1

3 months ago

0.18.2

3 months ago

0.18.0

3 months ago

0.17.0

3 months ago

0.17.1

3 months ago

0.16.2

3 months ago

0.16.0

4 months ago

0.16.1

4 months ago

0.15.0

5 months ago

0.15.1

5 months ago

0.14.2

7 months ago

0.12.0

8 months ago

0.11.1

8 months ago

0.10.3

8 months ago

0.13.1

7 months ago

0.13.2

7 months ago

0.13.3

7 months ago

0.10.1

9 months ago

0.10.2

9 months ago

0.10.0

9 months ago

0.3.0

9 months ago

0.9.0

9 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.5.0

9 months ago

0.2.3

9 months ago

0.4.0

9 months ago

0.3.1

9 months ago

0.2.2

9 months ago

0.7.0

9 months ago

0.5.2

9 months ago

0.6.0

9 months ago

0.5.1

9 months ago

0.2.1

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago