This repository was archived by the owner on Apr 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
78 lines (68 loc) · 2.17 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
78 lines (68 loc) · 2.17 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
stages:
- review
variables:
# GitLab automatically provides CI_PROJECT_ID and CI_MERGE_REQUEST_IID
# in merge request pipelines when CI_PIPELINE_SOURCE=merge_request_event
LLM_PROVIDER: anthropic
ANTHROPIC_MODEL: claude-sonnet-4-20250514
VERBOSE: 'true'
IGNORE_LOCK_FILES: 'true'
MAX_PROMPT_TOKENS: 150000
tiw-code-review:
stage: review
image: node:20-alpine
# Only run on merge request events
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Cache node_modules for faster builds
cache:
key:
files:
- yarn.lock
paths:
- node_modules/
- .yarn/cache/
before_script:
# Install dependencies
- apk add --no-cache git
- yarn install --frozen-lockfile
# Debug environment variables
- echo "🔍 CI Environment Check"
- echo "CI_PROJECT_ID=$CI_PROJECT_ID"
- echo "CI_MERGE_REQUEST_IID=$CI_MERGE_REQUEST_IID"
- echo "CI_PIPELINE_SOURCE=$CI_PIPELINE_SOURCE"
- |
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "❌ ANTHROPIC_API_KEY is not set or empty"
exit 1
else
echo "✅ ANTHROPIC_API_KEY is set (length: ${#ANTHROPIC_API_KEY})"
echo "✅ First 20 chars: ${ANTHROPIC_API_KEY:0:20}..."
fi
- |
if [ -z "$GITLAB_TOKEN" ]; then
echo "❌ GITLAB_TOKEN is not set or empty"
echo "💡 Please add GITLAB_TOKEN as a CI/CD variable in project settings"
echo "💡 Create a personal access token with 'api' scope at:"
echo " https://gitlab.com/-/profile/personal_access_tokens"
exit 1
else
echo "✅ GITLAB_TOKEN is set (length: ${#GITLAB_TOKEN})"
echo "✅ First 20 chars: ${GITLAB_TOKEN:0:20}..."
fi
script:
# Build the project
- echo "🔨 Building Tiw"
- yarn build
# Run the code review
- echo "🤖 Running Tiw Code Review"
- yarn start ci --platform gitlab --verbose
# Allow the job to fail without failing the entire pipeline
# This prevents blocking MRs if the review service has issues
allow_failure: true
# Only keep artifacts for failed jobs for debugging
artifacts:
when: on_failure
paths:
- reviews/
expire_in: 1 week