Skip to content

Commit ecd3fbe

Browse files
docs(gitlab): add drop-in .gitlab-ci.yml samples under gitlab/examples/
Adds two consumer-facing sample files plus a README so users have a canonical reference for what a Component-consuming .gitlab-ci.yml looks like: * gitlab/examples/.gitlab-ci.minimal.yml — shortest possible, every default accepted, only the two required CI/CD variables wired. * gitlab/examples/.gitlab-ci.example.yml — annotated, every input spelled out with safe-default guidance, plus an optional @droid fill block (commented out) showing how to add fill. * gitlab/examples/README.md — table mapping each file to its use case and the variable-setup story. Also updates docs/gitlab-setup.md: * Points readers at gitlab/examples/ instead of just inlining the snippet, so customers can clone the project, copy the file, done. * Drops the stale 'service account provisioning' reference now that the install-code-review skill no longer provisions SAs. * Tightens the GITLAB_TOKEN row to make the poster-identity story explicit: the token owner IS the poster, no API impersonation. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
1 parent 6f05311 commit ecd3fbe

4 files changed

Lines changed: 121 additions & 9 deletions

File tree

docs/gitlab-setup.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,29 @@ droid
1515
> /install-code-review
1616
```
1717

18-
It detects GitLab, optionally provisions a branded `Factory Droid` service
19-
account, asks the configuration questions below, generates the
20-
`.gitlab-ci.yml`, and opens an MR / direct-commits to the target project(s).
18+
It detects GitLab, asks which account should be the poster of review
19+
comments (you supply its PAT as `GITLAB_TOKEN`), asks the configuration
20+
questions below, generates the `.gitlab-ci.yml`, and opens an MR /
21+
direct-commits to the target project(s).
2122

2223
## Manual installation
2324

2425
### 1. Prerequisites
2526

26-
| Requirement | How to get it |
27-
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28-
| GitLab Maintainer role on the project | Repo admin grants you Maintainer (40) |
29-
| `FACTORY_API_KEY` CI/CD variable | Generate at <https://app.factory.ai/settings/api-keys>; add as **masked**, **unprotected** variable at the project, subgroup, or top-level group level |
30-
| `GITLAB_TOKEN` CI/CD variable | A personal or service-account access token with the `api` scope. Required so the MCP server can post comments back to the MR. Add as **masked**, **unprotected**. |
27+
| Requirement | How to get it |
28+
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
| GitLab Maintainer role on the project | Repo admin grants you Maintainer (40) |
30+
| `FACTORY_API_KEY` CI/CD variable | Generate at <https://app.factory.ai/settings/api-keys>; add as **masked**, **unprotected** variable at the project, subgroup, or top-level group level |
31+
| `GITLAB_TOKEN` CI/CD variable | A personal access token with the `api` scope, owned by whichever account should post review comments. The token owner is the poster — there is no API impersonation. Add as **masked**, **unprotected**. |
3132

3233
### 2. Add the CI/CD Component
3334

34-
Create or extend `.gitlab-ci.yml` in your project with:
35+
Drop-in samples live in [`gitlab/examples/`](../gitlab/examples/):
36+
37+
- [`.gitlab-ci.minimal.yml`](../gitlab/examples/.gitlab-ci.minimal.yml) — shortest possible, accepts every default.
38+
- [`.gitlab-ci.example.yml`](../gitlab/examples/.gitlab-ci.example.yml) — annotated with every input.
39+
40+
The minimal form looks like this; create or extend `.gitlab-ci.yml` in your project with:
3541

3642
```yaml
3743
include:
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Example .gitlab-ci.yml showcasing the droid-action GitLab CI/CD Component.
2+
#
3+
# Drop this file (or its snippets) at the root of your GitLab project.
4+
# It defines a single `droid-review` job that runs Factory Droid's
5+
# automated code review on every merge_request_event.
6+
#
7+
# Prerequisites (one-time, configured via the GitLab UI or `glab`):
8+
#
9+
# * FACTORY_API_KEY — masked CI/CD variable. Get one at
10+
# https://app.factory.ai/settings/api-keys
11+
#
12+
# * GITLAB_TOKEN — masked CI/CD variable. A personal access token
13+
# with `api` scope, minted by the GitLab user/account you want
14+
# review comments to be posted from. The poster identity IS the
15+
# owner of this token; there is no API impersonation. To switch
16+
# posters later, replace the variable's value.
17+
#
18+
# Both variables can be set at the project, subgroup, or top-level
19+
# group level, depending on how widely you want the review to roll out.
20+
21+
include:
22+
# Pin to a release tag once droid-action publishes one. Until then,
23+
# `main` tracks the latest stable cut. `droid_action_ref` below MUST
24+
# match the ref in this URL so the template and the runtime source
25+
# stay consistent.
26+
- remote: "https://raw.githubusercontent.com/Factory-AI/droid-action/main/gitlab/templates/review.yml"
27+
inputs:
28+
# ---- core review behavior ----
29+
automatic_review: "true" # run on every MR event; "false" disables
30+
review_depth: "deep" # "deep" (gpt-5.2 / high) or "shallow" (kimi-k2.6 / none)
31+
include_suggestions: "true" # post code-suggestion blocks for high-confidence fixes
32+
33+
# ---- security review (parallel security-reviewer subagent) ----
34+
automatic_security_review: "false" # enable to flag vulns alongside the regular review
35+
security_block_on_critical: "true" # block merge on CRITICAL findings (when security review is on)
36+
security_block_on_high: "false" # block merge on HIGH findings (defaults to false)
37+
38+
# ---- runtime source pin ----
39+
droid_action_ref: "main"
40+
41+
droid-review:
42+
variables:
43+
FACTORY_API_KEY: $FACTORY_API_KEY
44+
GITLAB_TOKEN: $GITLAB_TOKEN
45+
# ---- Optional: add @droid fill mode -------------------------------------
46+
#
47+
# Uncomment the include below to also auto-fill new MRs' descriptions
48+
# from their diffs. The fill job fires on the same `merge_request_event`
49+
# trigger as the review job; together they form Factory Droid's GA GitLab
50+
# experience.
51+
#
52+
# include:
53+
# - remote: "https://raw.githubusercontent.com/Factory-AI/droid-action/main/gitlab/templates/fill.yml"
54+
# inputs:
55+
# automatic_fill: "false" # true = fill every new MR automatically
56+
# droid_action_ref: "main"
57+
#
58+
# droid-fill:
59+
# variables:
60+
# FACTORY_API_KEY: $FACTORY_API_KEY
61+
# GITLAB_TOKEN: $GITLAB_TOKEN
62+
#
63+
# With automatic_fill="false", trigger fill manually per MR by either:
64+
# - writing "@droid fill" in the MR description, OR
65+
# - writing "@droid fill" in the MR title, OR
66+
# - adding the "droid:fill" label to the MR.
67+
#
68+
# After Droid fills the description, it strips the @droid fill token so
69+
# the next merge_request_event doesn't re-trigger.
70+
# -----------------------------------------------------------------------
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Minimal example: every default, just `include:` the Component.
2+
#
3+
# Requires FACTORY_API_KEY and GITLAB_TOKEN to be set as masked CI/CD
4+
# variables. See .gitlab-ci.example.yml for the annotated version.
5+
6+
include:
7+
- remote: "https://raw.githubusercontent.com/Factory-AI/droid-action/main/gitlab/templates/review.yml"
8+
9+
droid-review:
10+
variables:
11+
FACTORY_API_KEY: $FACTORY_API_KEY
12+
GITLAB_TOKEN: $GITLAB_TOKEN

gitlab/examples/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# GitLab examples
2+
3+
Drop-in `.gitlab-ci.yml` samples for consuming the droid-action GitLab
4+
CI/CD Component.
5+
6+
| File | When to use |
7+
| ------------------------ | -------------------------------------------------------------------------------------------------------------- |
8+
| `.gitlab-ci.minimal.yml` | Shortest possible — `include:` the review template, accept every default. Good starting point. |
9+
| `.gitlab-ci.example.yml` | Annotated. Every input spelled out with comments explaining what it does and what the safe defaults look like. |
10+
11+
Both samples wire the same two required CI/CD variables:
12+
13+
- `FACTORY_API_KEY` — get one at <https://app.factory.ai/settings/api-keys>.
14+
- `GITLAB_TOKEN` — a personal access token with `api` scope, owned by
15+
whichever GitLab user/account should be the poster of review comments.
16+
To change the poster later, replace this variable's value.
17+
18+
Set both as **masked** CI/CD variables at the level you want the review
19+
to apply (project, subgroup, or top-level group).
20+
21+
For the full input reference (model overrides, security review,
22+
suggestion blocks, custom stage, etc.) see
23+
[`../templates/review.yml`](../templates/review.yml) or the docs at
24+
[`docs/gitlab-setup.md`](../../docs/gitlab-setup.md).

0 commit comments

Comments
 (0)