refactor(ci): extract repo config as env vars in CI examples#195
Closed
m0Nst3r873 wants to merge 10 commits into
Closed
refactor(ci): extract repo config as env vars in CI examples#195m0Nst3r873 wants to merge 10 commits into
m0Nst3r873 wants to merge 10 commits into
Conversation
--other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
QCI does not provide CI_MERGE_REQUEST_URL. Build the MR URL from QCI_REPO and QCI_MR_IID instead, and skip gracefully when triggered manually (QCI_MR_IID is empty). --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
QCI sets MR variables to the string "None" (not empty) when triggered manually. Check for both empty and "None" to skip gracefully. --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Users must fill these in; placeholder strings cause confusing errors. --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Key fixes: - Use .netrc for TGit auth instead of teamai init - Remove task-level when: conditions, use script-level checks - Install @anthropic-ai/claude-code alongside teamai-cli - Add proper mr: config (action, is_local_mr, auto_cancel) - Check QCI_TRIGGER_TYPE + QCI_MR_ACTION in script --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
teamai-cli uses gf CLI as the primary method to fetch TGit MR data. The REST API fallback also requires the OAuth token from gf's credential store. Without gf CLI installed, both paths fail with 401. --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
teamai init prompts for team repo interactively, which fails in CI. Pass --repo flag with TEAMAI_KNOWLEDGE_REPO to skip the prompt. --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Short paths like "team/repo" are mistakenly detected as GitHub repos. Using the full https://git.woa.com/ URL forces TGit provider detection. --other=0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 tasks
Collaborator
Author
|
Superseded by #210. #210 folds in this PR's CI-example refactor (top-level Closing in favor of #210. |
m0Nst3r873
added a commit
to m0Nst3r873/teamai-cli
that referenced
this pull request
Jul 20, 2026
The TeamAI MR knowledge-extract CI pipeline failed on every run because
TGit REST calls sent `Authorization: Bearer`, but a git.woa.com Personal
Access Token only authenticates via `PRIVATE-TOKEN`/`private_token`
(Bearer → 401/403). Verified live against git.woa.com/api/v3.
Changes:
- Add src/providers/tgit/rest-auth.ts: centralized tgitFetch() that uses
PRIVATE-TOKEN for a PAT (TGIT_TOKEN env) and Bearer for an OAuth token
(~/.netrc), with a one-shot 401/403 scheme fallback + process cache.
- Rewrite mr-fetch.ts to REST-only: the gf CLI has no `mr desc`/`mr diff`
commands and cannot return a diff. Fix diff endpoint to singular
merge_request/{globalId}/changes, read files[]/changes[], fall back
merged_at → resolved_at → updated_at, and fix an always-true MR match.
- Route all TGit REST callers (gf-cli, mr-comment, read-rejections,
extract-mr, gf-org, mr-hint) through the helper.
- Rename the TGit token env var TAI_PAT_TOKEN → TGIT_TOKEN (TGit usages
only; iWiki's TAI_PAT_TOKEN is a different token and is left untouched).
- CI examples: consolidate repo config into a top-level env block and add
the github-actions example (supersedes PR Tencent#195), reconciled to TGIT_TOKEN.
- Add rest-auth unit tests; make the gf-org no-credentials test env-independent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
m0Nst3r873
added a commit
to m0Nst3r873/teamai-cli
that referenced
this pull request
Jul 20, 2026
The TeamAI MR knowledge-extract CI pipeline failed on every run because
TGit REST calls sent `Authorization: Bearer`, but a git.woa.com Personal
Access Token only authenticates via `PRIVATE-TOKEN`/`private_token`
(Bearer → 401/403). Verified live against git.woa.com/api/v3.
Changes:
- Add src/providers/tgit/rest-auth.ts: centralized tgitFetch() that uses
PRIVATE-TOKEN for a PAT (TGIT_TOKEN env) and Bearer for an OAuth token
(~/.netrc), with a one-shot 401/403 scheme fallback + process cache.
- Rewrite mr-fetch.ts to REST-only: the gf CLI has no `mr desc`/`mr diff`
commands and cannot return a diff. Fix diff endpoint to singular
merge_request/{globalId}/changes, read files[]/changes[], fall back
merged_at → resolved_at → updated_at, and fix an always-true MR match.
- Route all TGit REST callers (gf-cli, mr-comment, read-rejections,
extract-mr, gf-org, mr-hint) through the helper.
- Rename the TGit token env var TAI_PAT_TOKEN → TGIT_TOKEN (TGit usages
only; iWiki's TAI_PAT_TOKEN is a different token and is left untouched).
- CI examples: consolidate repo config into a top-level env block and add
the github-actions example (supersedes PR Tencent#195), reconciled to TGIT_TOKEN.
- Add rest-auth unit tests; make the gf-org no-credentials test env-independent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jeff-r2026
pushed a commit
that referenced
this pull request
Jul 20, 2026
…EN (#210) The TeamAI MR knowledge-extract CI pipeline failed on every run because TGit REST calls sent `Authorization: Bearer`, but a git.woa.com Personal Access Token only authenticates via `PRIVATE-TOKEN`/`private_token` (Bearer → 401/403). Verified live against git.woa.com/api/v3. Changes: - Add src/providers/tgit/rest-auth.ts: centralized tgitFetch() that uses PRIVATE-TOKEN for a PAT (TGIT_TOKEN env) and Bearer for an OAuth token (~/.netrc), with a one-shot 401/403 scheme fallback + process cache. - Rewrite mr-fetch.ts to REST-only: the gf CLI has no `mr desc`/`mr diff` commands and cannot return a diff. Fix diff endpoint to singular merge_request/{globalId}/changes, read files[]/changes[], fall back merged_at → resolved_at → updated_at, and fix an always-true MR match. - Route all TGit REST callers (gf-cli, mr-comment, read-rejections, extract-mr, gf-org, mr-hint) through the helper. - Rename the TGit token env var TAI_PAT_TOKEN → TGIT_TOKEN (TGit usages only; iWiki's TAI_PAT_TOKEN is a different token and is left untouched). - CI examples: consolidate repo config into a top-level env block and add the github-actions example (supersedes PR #195), reconciled to TGIT_TOKEN. - Add rest-auth unit tests; make the gf-org no-credentials test env-independent. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
m0Nst3r873
added a commit
to m0Nst3r873/teamai-cli
that referenced
this pull request
Jul 20, 2026
The TeamAI MR knowledge-extract CI pipeline failed on every run because
TGit REST calls sent `Authorization: Bearer`, but a git.woa.com Personal
Access Token only authenticates via `PRIVATE-TOKEN`/`private_token`
(Bearer → 401/403). Verified live against git.woa.com/api/v3.
Changes:
- Add src/providers/tgit/rest-auth.ts: centralized tgitFetch() that uses
PRIVATE-TOKEN for a PAT (TGIT_TOKEN env) and Bearer for an OAuth token
(~/.netrc), with a one-shot 401/403 scheme fallback + process cache.
Also tgitGitUser()/tryGetTGitToken() for git-over-HTTPS auth.
- Rewrite mr-fetch.ts to REST-only: the gf CLI has no `mr desc`/`mr diff`
commands and cannot return a diff. Fix diff endpoint to singular
merge_request/{globalId}/changes, read files[]/changes[], fall back
merged_at → resolved_at → updated_at, and fix an always-true MR match.
- Route all TGit REST callers through the helper.
- Fix git-over-HTTPS clone for a PAT: a PAT authenticates git as username
`private`, an OAuth token as `oauth2`. gfRepoClone now uses token-based
`git clone` with the scheme-derived username for all repos when a token
is present, falling back to `gf repo clone` only when no token exists
(the interactive path). clone.ts uses the same scheme-based username.
init.ts no longer treats a "repo already exists" create error as fatal.
- Rename the TGit token env var TAI_PAT_TOKEN → TGIT_TOKEN (TGit usages
only; iWiki's TAI_PAT_TOKEN is a different token and is left untouched).
- CI examples: consolidate repo config into a top-level env block, add the
github-actions example (supersedes PR Tencent#195), use `private:` for git auth.
- Add rest-auth unit tests (auth scheme, git username, token resolution).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
env:块中的环境变量TEAMAI_KNOWLEDGE_REPO、TEAMAI_KNOWLEDGE_BRANCH、ANTHROPIC_AUTH_TOKEN等变量声明env:顶部配置,无需在 YAML 中搜索散落的占位符Test plan
env:格式、secret:vsvalue:语法)${{ vars.* }}/${{ env.* }}引用)git clone -b命令拼接环境变量正确🤖 Generated with Claude Code