Skip to content

Commit dadf6a8

Browse files
authored
feat: Add .gitlab-ci.yml pipeline (#5)
1 parent 23dc2b7 commit dadf6a8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.gitlab-ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Perform a code review on a merge request using the Sourcery review
2+
3+
# GitLab setup instructions:
4+
# 1. Add the `sourcery_review` pipeline below into your project's `.gitlab-ci.yml`
5+
# 2. Create a Project/Group Access Token for posting reviews to merge requests - `SOURCERY_AI_BOT`
6+
# - Go to Settings > Access Tokens
7+
# - Create a new Access Token with name `SOURCERY_AI_BOT` and scope `api`
8+
# - Click on "Create access token"
9+
# 3. Store your Sourcery token as a Project/Group CI/CD variable - `SOURCERY_TOKEN`
10+
# - First get your Sourcery token
11+
# - Go to Settings > CI/CD
12+
# - Expand the Variables section.
13+
# - Add a new variable:
14+
# - Key: `SOURCERY_TOKEN`.
15+
# - Value: <Your Sourcery token>
16+
# - Flags:
17+
# - ❌ Protect variable
18+
# - ✅ Mask variable
19+
# - ❌ Expand variable reference
20+
# - Click on "Add variable"
21+
22+
sourcery_review:
23+
stage: test
24+
image: python:slim
25+
script:
26+
- pip install --pre sourcery-nightly
27+
- sourcery login --token $SOURCERY_TOKEN
28+
- |
29+
sourcery assistant review gitlab-merge-request \
30+
--gitlab-token $SOURCERY_AI_BOT \
31+
--project $CI_PROJECT_PATH \
32+
--merge-request $CI_MERGE_REQUEST_IID \
33+
--commit $CI_COMMIT_SHA
34+
rules:
35+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'

0 commit comments

Comments
 (0)