openwiki_update: image: node:22 stage: deploy rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' - if: '$CI_PIPELINE_SOURCE == "web"' before_script: - apt-get update && apt-get install -y git curl # mermaid + jsdom are optional; they add high-fidelity validation of Mermaid diagrams. Remove if your wiki has none. - npm install --global openwiki mermaid@11.16.0 jsdom@29.1.1 - git config user.name "${GITLAB_USER_NAME:-OpenWiki Bot}" - git config user.email "${GITLAB_USER_EMAIL:-openwiki@example.com}" script: - openwiki code --update --print - | if git diff --quiet -- openwiki AGENTS.md CLAUDE.md .github/workflows/openwiki-update.yml; then echo "OpenWiki is already up to date." exit 0 fi - export OPENWIKI_BRANCH="openwiki/update-${CI_PIPELINE_ID}" - git checkout -b "$OPENWIKI_BRANCH" - git add openwiki AGENTS.md CLAUDE.md .github/workflows/openwiki-update.yml - git commit -m "docs: update OpenWiki" - git push "https://oauth2:${OPENWIKI_GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "$OPENWIKI_BRANCH" - | curl --fail --request POST \ --header "PRIVATE-TOKEN: ${OPENWIKI_GITLAB_TOKEN}" \ --form "source_branch=${OPENWIKI_BRANCH}" \ --form "target_branch=${CI_DEFAULT_BRANCH}" \ --form "title=docs: update OpenWiki" \ --form "description=Automated OpenWiki documentation update generated by the scheduled GitLab pipeline." \ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/merge_requests" variables: OPENWIKI_PROVIDER: openrouter OPENWIKI_MODEL_ID: z-ai/glm-5.2 LANGCHAIN_PROJECT: openwiki LANGCHAIN_TRACING_V2: "true"