Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add .gitlab-ci.yml pipeline #5

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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` 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
brendanator marked this conversation as resolved.
Show resolved Hide resolved
- sourcery login --token $SOURCERY_TOKEN
- |
sourcery assistant review gitlab-merge-request \
--gitlab-token $SOURCERY_AI_BOT \
brendanator marked this conversation as resolved.
Show resolved Hide resolved
--project $CI_PROJECT_PATH \
--merge-request $CI_MERGE_REQUEST_IID \
--commit $CI_COMMIT_SHA
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'