← Gitlab + Node integrations

Run Node Code with Node API on New Commit Comment (Instant) from Gitlab API

Pipedream makes it easy to connect APIs for Node, Gitlab and 1000+ other apps remarkably fast.

Trigger workflow on
New Commit Comment (Instant) from the Gitlab API
Next, do this
Run Node Code with the Node API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Gitlab trigger and Node action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Commit Comment (Instant) trigger
    1. Connect your Gitlab account
    2. Select a Project ID
  3. Configure the Run Node Code action
    1. Connect your Node account
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, open source components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emit new event when a commit receives a comment
Version:0.1.0
Key:gitlab-new-commit-comment

Trigger Code

import base from "../common/base.mjs";
import { eventTypes } from "../common/hook-events.mjs";

export default {
  ...base,
  key: "gitlab-new-commit-comment",
  name: "New Commit Comment (Instant)",
  description: "Emit new event when a commit receives a comment",
  version: "0.1.0",
  dedupe: "unique",
  type: "source",
  hooks: {
    ...base.hooks,
    async activate() {
      await this.activateHook(eventTypes.NOTE_EVENTS);
    },
  },
  methods: {
    ...base.methods,
    isCommentOnCommit(commit) {
      const noteableType = commit.object_attributes?.noteable_type;
      const expectedNoteableType = "Commit";
      return noteableType === expectedNoteableType;
    },
    generateMeta({
      user, comment,
    }) {
      const {
        name,
        username,
      } = user;
      const {
        id,
        created_at: createdAt,
        commit_id: commitId,
      } = comment;
      return {
        id,
        summary: `New comment by ${name} (${username}) on commit ${commitId}`,
        ts: +new Date(createdAt),
      };
    },
    async emitEvent(event) {
      // Gitlab doesn't offer a specific hook for "commit comments" events,
      // but such event can be deduced from the payload of "note" events.
      if (this.isCommentOnCommit(event)) {
        const meta = this.generateMeta({
          user: event.user,
          comment: event.object_attributes,
        });
        this.$emit(event, meta);
      }
    },
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
GitlabgitlabappThis component uses the Gitlab app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between component invocations.
N/Ahttp$.interface.httpThis component uses $.interface.http to generate a unique URL when the component is first instantiated. Each request to the URL will trigger the run() method of the component.
Project IDprojectIdintegerSelect a value from the drop down menu.

Trigger Authentication

Gitlab uses OAuth authentication. When you connect your Gitlab account, Pipedream will open a popup window where you can sign into Gitlab and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Gitlab API.

Pipedream requests the following authorization scopes when you connect your account:

apiread_userread_repositorywrite_repositoryread_registrysudoopenidprofileemail

About Gitlab

Project planning and source code management

Action

Description:Write custom Node.js code and use any of the 400k+ npm packages available. Refer to the [Pipedream Node docs](https://pipedream.com/docs/code/nodejs) to learn more.
Version:0.0.2
Key:node-run-node-code

Action Code

import node from "../../node.app.mjs";

export default {
  name: "Run Node Code",
  version: "0.0.2",
  key: "node-run-node-code",
  description: "Write custom Node.js code and use any of the 400k+ npm packages available. Refer to the [Pipedream Node docs](https://pipedream.com/docs/code/nodejs) to learn more.",
  props: {
    node,
  },
  type: "action",
  methods: {},
  async run({
    steps, $,
  }) {
    // Return data to use it in future steps
    return steps.trigger.event;
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
NodenodeappThis component uses the Node app.

Action Authentication

The Node API does not require authentication.

About Node

Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.

More Ways to Connect Node + Gitlab

Run Node Code with Node API on New Review Request (Instant) from Gitlab API
Gitlab + Node
 
Try it
Run Node Code with Node API on New Milestone from Gitlab API
Gitlab + Node
 
Try it
Run Node Code with Node API on New Project from Gitlab API
Gitlab + Node
 
Try it
Run Node Code with Node API on New Merge Request (Instant) from Gitlab API
Gitlab + Node
 
Try it
Run Node Code with Node API on New Mention (Instant) from Gitlab API
Gitlab + Node
 
Try it
New Commit (Instant) from the Gitlab API

Emit new event when a new commit is pushed to a branch

 
Try it
New Branch (Instant) from the Gitlab API

Emit new event when a new branch is created

 
Try it
New Project from the Gitlab API

Emit new event when a project (i.e. repository) is created

 
Try it
New Audit Event (Instant) from the Gitlab API

Emit new event when a new audit event is created

 
Try it
New Commit Comment (Instant) from the Gitlab API

Emit new event when a commit receives a comment

 
Try it
Create Branch with the Gitlab API

Create a new branch in the repository. See docs

 
Try it
Create Epic with the Gitlab API

Creates a new epic. See docs

 
Try it
Create issue with the Gitlab API

Creates a new issue. See docs

 
Try it
Edit Issue with the Gitlab API

Updates an existing project issue. See docs

 
Try it
Get Issue with the Gitlab API

Gets a single issue from repository. See docs

 
Try it