Aller au contenu principal

GitLab mentions

Connect your GitLab so that your team can call an agent from where they work: mention a bot account (for example @breign-bot) in a comment on an issue, a merge request or a commit, and the agent reads the thread, does the work, and answers there.

Setting it up takes two steps: an administrator connects the GitLab instance and its bot accounts, then each agent gets an automation that reacts to mentions.

Before you start​

  • Connecting GitLab is reserved for organization administrators.
  • You need a GitLab account to act as the bot, with a personal access token that has the api scope.
  • Integrations must be enabled on your platform.

Connect the GitLab instance (administrators)​

  1. On the Organization side, open Settings, then Integrations.
  2. Enter a Name and the Instance URL (for example https://gitlab.example.com), then click Add the instance.
  3. Copy the URL to declare in GitLab and the Secret token. In GitLab, open the project (or group) Settings › Webhooks, add the URL and token, and tick Comments, Issues and Merge requests.
  4. Under Bot accounts, click Add an account and fill in:
    • the bot's Personal access token (api scope);
    • the Default agent, which answers when nobody is named (or none, and the bot answers with help);
    • the Agents callable by name: all, or a selection;
    • Runs as: the member whose tools and quotas apply;
    • the Minimal author level in GitLab (Guest to Owner) for a mention to be taken into account.
  5. Click Test connection, then Test routing with a sample comment to see which agent would answer.

Latest events lists what GitLab sent and what Breign did with it. Generate a new secret replaces the webhook token (update it in GitLab).

Make an agent react to mentions​

  1. Open the agent and go to its Automations tab, then New automation.
  2. Choose External event, then GitLab mention.
  3. Choose the bot accounts it answers through, the kinds of threads (Issues, Merge requests, Commits, Work items) and the Projects (all projects, or group/project, group/*).
  4. Write the Message to send, with the variables offered to insert the thread's content.
  5. Under Reply, choose whether the agent replies in the GitLab thread and whether it acknowledges the mention right away.
  6. Click Create automation.

Result​

When someone writes @breign-bot can you review this MR? in a thread that matches, the agent runs, and its answer is posted in the thread. Each run appears in the automation's history and in the organization's Automations page, with Triggered by showing who mentioned the bot and where.

If something goes wrong​

  • "GitLab rejected this token.": the token is wrong, expired, or lacks the api scope.
  • "GitLab cannot be reached from Breign.": the instance isn't reachable from the internet, or a firewall blocks Breign.
  • "This address points to a private or reserved network…": Breign can't call instances on a private network.
  • "Two callable agents share the same name…": rename one of them so mentions are unambiguous.
  • "No GitLab bot account yet." in the automation form: an administrator must add one in Integrations.
  • The bot doesn't answer: check Latest events in Integrations, the author's GitLab level, and that the project matches the automation's Projects.
  • "Integrations are not enabled on this server.": contact whoever operates your platform.