← Gitlab + Airtable integrations

Update record with Airtable API on New Review Request (Instant) from Gitlab API

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

Trigger workflow on
New Review Request (Instant) from the Gitlab API
Next, do this
Update record with the Airtable API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜

Trusted by 500,000+ developers from startups to Fortune 500 companies

Adyen logo
Brex logo
Carta logo
Checkr logo
Chameleon logo
DevRev logo
LinkedIn logo
Netflix logo
New Relic logo
OnDeck logo
Replicated logo
Scale AI logo
Teamwork logo
Warner Bros. logo
Xendit logo

Developers Pipedream

Getting Started

This integration creates a workflow with a Gitlab trigger and Airtable 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 Review Request (Instant) trigger
    1. Connect your Gitlab account
    2. Select a Project ID
  3. Configure the Update record action
    1. Connect your Airtable account
    2. Select a Base
    3. Select a Table
    4. Configure Record ID
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, source-available 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 reviewer is added to a merge request
Version:0.1.0
Key:gitlab-new-review-request

Gitlab Overview

Gitlab API allows developers to access the functionality of Gitlab. With the
Gitlab API, developers can integrate Gitlab with other applications, create
custom applications, or automate tasks.

Some examples of what you can build using the Gitlab API include:

  • Automate tasks such as creating and managing repositories
  • Integrate Gitlab with other applications such as your chat application
  • Create custom applications on top of Gitlab

Trigger Code

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

export default {
  ...base,
  key: "gitlab-new-review-request",
  name: "New Review Request (Instant)",
  description: "Emit new event when a reviewer is added to a merge request",
  version: "0.1.0",
  dedupe: "unique",
  type: "source",
  hooks: {
    ...base.hooks,
    async activate() {
      await this.activateHook([
        eventTypes.MERGE_REQUESTS_EVENTS,
        eventTypes.PUSH_EVENT,
      ]);
    },
  },
  methods: {
    ...base.methods,
    getNewReviewers(event) {
      const {
        action,
        title,
      } = event.object_attributes;

      // When a merge request is first created, any assignees
      // in it are interpreted as new review requests.
      if (action === "open" || action === "reopen") {
        const { assignees = [] } = event;
        return assignees;
      }

      // Gitlab API provides any merge request update diff
      // as part of their response. We can check the presence of
      // the `assignees` attribute within those changes to verify
      // if there are new review requests.
      const { assignees } = event.changes;
      if (!assignees) {
        console.log(`No new assignees in merge request "${title}"`);
        return [];
      }

      // If the assignees of the merge request changed, we need to compute
      // the difference in order to extract the new reviewers.
      const previousAssignees = new Set(assignees.previous.map((a) => a.username));
      const newAssignees = assignees.current.filter((a) => !previousAssignees.has(a.username));
      if (newAssignees.length > 0) {
        console.log(`Assignees added to merge request "${title}": ${newAssignees.map((a) => a.username).join(", ")}`);
      }
      return newAssignees;
    },
    generateMeta(event, reviewer) {
      const {
        id,
        title,
        updated_at: updatedAt,
      } = event.object_attributes;
      const ts = +new Date(updatedAt);
      return {
        id: `${id}-${ts}-${reviewer.username}`,
        summary: `New reviewer for "${title}": ${reviewer.username}`,
        ts,
      };
    },
    async emitEvent(event) {
      // Gitlab doesn't offer a specific hook for "new merge request reviewers" events,
      // but such event can be deduced from the payload of "merge request" events.
      this.getNewReviewers(event).forEach((reviewer) => {
        const meta = this.generateMeta(event, reviewer);
        this.$emit({
          ...event,
          reviewer,
        }, 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 executions.
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:Update a single record in a table by Record ID.
Version:1.0.2
Key:airtable-update-record

Airtable Overview

Using the Airtable API, you can build applications that can:

  • Create and manage databases
  • Add, update, and delete records
  • Search for records
  • Sort and filter records
  • Display records in a variety of ways
  • Import and export data

Action Code

import airtable from "../../airtable.app.mjs";
import common from "../common.mjs";
import commonActions from "../../common/actions.mjs";

export default {
  key: "airtable-update-record",
  name: "Update record",
  description: "Update a single record in a table by Record ID.",
  version: "1.0.2",
  type: "action",
  props: {
    ...common.props,
    // eslint-disable-next-line pipedream/props-label,pipedream/props-description
    tableId: {
      ...common.props.tableId,
      reloadProps: true,
    },
    recordId: {
      propDefinition: [
        airtable,
        "recordId",
      ],
    },
  },
  async additionalProps() {
    return commonActions.additionalProps(this);
  },
  async run({ $ }) {
    return commonActions.updateRecord(this, $);
  },
};

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
AirtableairtableappThis component uses the Airtable app.
BasebaseIdstringSelect a value from the drop down menu.
TabletableIdstringSelect a value from the drop down menu.
Record IDrecordIdstring

Enter a record ID (eg. recxxxxxxx).

Action Authentication

Airtable uses API keys for authentication. When you connect your Airtable account, Pipedream securely stores the keys so you can easily authenticate to Airtable APIs in both code and no-code steps.

Visit your account settings, copy your API key, and enter it below. If you only need to read data from Airtable, and not modify it, you can generate a read-only API key.


get airtable api key

About Airtable

Looks like a spreadsheet, acts like a database.

More Ways to Connect Airtable + Gitlab

Delete Record with Airtable API on New Review Request (Instant) from Gitlab API
Gitlab + Airtable
 
Try it
Get Record with Airtable API on New Review Request (Instant) from Gitlab API
Gitlab + Airtable
 
Try it
List Records in View with Airtable API on New Review Request (Instant) from Gitlab API
Gitlab + Airtable
 
Try it
List Records with Airtable API on New Review Request (Instant) from Gitlab API
Gitlab + Airtable
 
Try it
Create Multiple Records with Airtable API on New Review Request (Instant) from Gitlab API
Gitlab + Airtable
 
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