Skip to content

Commit 6fc73a4

Browse files
committed
fix: gitlab-ci YAML multiline syntax for git push
1 parent 998b14e commit 6fc73a4

1 file changed

Lines changed: 13 additions & 31 deletions

File tree

.gitlab-ci.yml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,23 @@ sync-upstream:
55
stage: sync
66
image: python:3.12-slim
77
rules:
8-
# Weekly schedule (configure in GitLab > CI/CD > Schedules: cron 0 6 * * 1)
98
- if: $CI_PIPELINE_SOURCE == "schedule"
10-
# Manual trigger from UI
119
- if: $CI_PIPELINE_SOURCE == "web"
1210
before_script:
1311
- apt-get update -qq && apt-get install -y -qq git > /dev/null
1412
- git config --global user.email "ci@${CI_SERVER_HOST}"
1513
- git config --global user.name "GitLab CI Sync Bot"
1614
script:
17-
# Clone upstream source
18-
- git clone --depth 1 https://github.com/javaevolved/javaevolved.github.io.git /tmp/upstream
19-
- YAML_COUNT=$(find /tmp/upstream/content -name "*.yaml" | wc -l | tr -d ' ')
20-
- UPSTREAM_SHA=$(cd /tmp/upstream && git rev-parse --short HEAD)
21-
- UPSTREAM_DATE=$(cd /tmp/upstream && git log -1 --format=%cs)
22-
- echo "Found $YAML_COUNT upstream patterns (commit $UPSTREAM_SHA from $UPSTREAM_DATE)"
23-
24-
# Regenerate references
25-
- python3 scripts/generate-references.py --content-dir /tmp/upstream/content --output-dir references/
26-
27-
# Check for changes
28-
- |
29-
if git diff --quiet -- references/; then
30-
echo "No changes detected — references are up to date."
31-
exit 0
32-
fi
33-
34-
# Push changes as a new MR branch
35-
- BRANCH="sync/upstream-${UPSTREAM_SHA}"
36-
- git checkout -b "$BRANCH"
37-
- git add references/
38-
- git commit -m "chore: sync references from upstream ($UPSTREAM_SHA)"
39-
- git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
40-
- git push -o merge_request.create
41-
-o merge_request.title="Sync: Update patterns from java.evolved ($UPSTREAM_DATE)"
42-
-o merge_request.description="Automated sync from [javaevolved](https://github.com/javaevolved/javaevolved.github.io). Upstream commit: $UPSTREAM_SHA. Patterns: $YAML_COUNT."
43-
-o merge_request.remove_source_branch
44-
-o merge_request.label="automated,sync"
45-
origin "$BRANCH"
15+
- "git clone --depth 1 https://github.com/javaevolved/javaevolved.github.io.git /tmp/upstream"
16+
- "YAML_COUNT=$(find /tmp/upstream/content -name '*.yaml' | wc -l | tr -d ' ')"
17+
- "UPSTREAM_SHA=$(cd /tmp/upstream && git rev-parse --short HEAD)"
18+
- "UPSTREAM_DATE=$(cd /tmp/upstream && git log -1 --format=%cs)"
19+
- "echo Found $YAML_COUNT upstream patterns commit $UPSTREAM_SHA from $UPSTREAM_DATE"
20+
- "python3 scripts/generate-references.py --content-dir /tmp/upstream/content --output-dir references/"
21+
- "if git diff --quiet -- references/; then echo No changes detected; exit 0; fi"
22+
- "BRANCH=sync/upstream-${UPSTREAM_SHA}"
23+
- "git checkout -b $BRANCH"
24+
- "git add references/"
25+
- "git commit -m 'chore: sync references from upstream'"
26+
- "git remote set-url origin https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
27+
- "git push -o merge_request.create -o merge_request.remove_source_branch origin $BRANCH"

0 commit comments

Comments
 (0)