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