image: node:22 pipelines: # Configure a scheduled pipeline in Repository settings > Pipelines > Schedules # that runs the "openwiki-update" custom pipeline below (e.g. daily). custom: openwiki-update: - step: name: Run OpenWiki update 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 "${BITBUCKET_USER_NAME:-OpenWiki Bot}" - git config user.email "${BITBUCKET_USER_EMAIL:-openwiki@example.com}" - 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-${BITBUCKET_BUILD_NUMBER}" - 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://x-token-auth:${OPENWIKI_BITBUCKET_TOKEN}@bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}.git" "$OPENWIKI_BRANCH" - | curl --fail --request POST \ --url "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/pullrequests" \ --header "Authorization: Bearer ${OPENWIKI_BITBUCKET_TOKEN}" \ --header "Content-Type: application/json" \ --data "{\"title\":\"docs: update OpenWiki\",\"description\":\"Automated OpenWiki documentation update generated by the scheduled Bitbucket pipeline.\",\"source\":{\"branch\":{\"name\":\"${OPENWIKI_BRANCH}\"}},\"destination\":{\"branch\":{\"name\":\"${BITBUCKET_BRANCH}\"}}}" # TODO: Replace with your preferred inference provider and model # OPENWIKI_BITBUCKET_TOKEN must be a repository access token with # write access to repositories and pull requests.