fix: make code mode provider-aware instead of hardcoding GitHub#342
Open
Victor Micó (victor-mico) wants to merge 1 commit into
Open
fix: make code mode provider-aware instead of hardcoding GitHub#342Victor Micó (victor-mico) wants to merge 1 commit into
Victor Micó (victor-mico) wants to merge 1 commit into
Conversation
`openwiki code` always wrote `.github/workflows/openwiki-update.yml` and hardcoded "GitHub Actions workflow" wording in the AGENTS.md/CLAUDE.md OPENWIKI block, even on GitLab/Bitbucket repos. This reintroduced GitHub-specific artifacts on every run that CI then had to scrub. Detect the git host from the repository remote (overridable via `OPENWIKI_CI_PROVIDER=github|gitlab|bitbucket|none`) and: - only write the GitHub Actions workflow when the host is GitHub; - phrase the OPENWIKI block to match the detected host (GitHub Actions workflow / GitLab pipeline / Bitbucket pipeline / neutral update job). Undetectable hosts and missing remotes fall back to GitHub, preserving the historical default. The GitLab/Bitbucket example pipelines now set the provider explicitly and no longer track the GitHub workflow path. Fixes langchain-ai#341 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| } | ||
|
|
||
| const lower = remoteUrl.toLowerCase(); | ||
| if (lower.includes("gitlab")) { |
Contributor
There was a problem hiding this comment.
is it safe to match on the entire url? should we just be matching on the host part? for example, what if someone has something like:
git@github.com:acme/gitlab-importer.git
|
|
||
| // Provider-aware phrasing for the OPENWIKI agent-file block so the sentence is | ||
| // accurate on non-GitHub hosts instead of always claiming a GitHub Actions run. | ||
| function describeCodeModeUpdateJob(provider: CiProvider): string { |
Contributor
There was a problem hiding this comment.
does this need a default case?
Colin Francis (colifran)
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR Victor Micó (@victor-mico)! Left a few comments but otherwise looks great.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Fixes #341.
openwiki codewas hardcoded to GitHub in two places, so non-GitHub repos (GitLab, Bitbucket) got GitHub-specific artifacts reintroduced on every run:.github/workflows/openwiki-update.ymlwas written unconditionally on both the interactive and--print(CI) paths — forcing pipelines torm -rf .githubbefore committing.<!-- OPENWIKI:START -->…<!-- OPENWIKI:END -->block inAGENTS.md/CLAUDE.mdalways said "GitHub Actions workflow", which is wrong on other hosts and, because the block is regenerated each run, reverted any manual correction (a recurring misleading diff).What changed
src/code-mode.ts: detect the git host from the repository remote (origin, falling back to any remote), overridable viaOPENWIKI_CI_PROVIDER=github|gitlab|bitbucket|none.examples/: the GitLab and Bitbucket pipelines setOPENWIKI_CI_PROVIDERexplicitly and no longer track the now-unwritten.github/workflows/openwiki-update.ymlpath in theirgit diff/git addsteps.README.md: documents detection behavior and theOPENWIKI_CI_PROVIDERoverride.How it was tested
test/code-mode.test.ts: workflow is skipped with matching wording for gitlab/bitbucket/none; provider is detected from a real git remote; env override wins over detection; default-to-GitHub when no remote exists.pnpm run format,pnpm run lint,pnpm testall pass locally (254 tests).🤖 Generated with Claude Code