You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: auto-detect code wiki branch for wiki page safe outputs (#115)
* fix: auto-detect code wiki branch for wiki page safe outputs
The ADO Wiki Pages API requires an explicit versionDescriptor for write
operations on code wikis (type 1). Rather than requiring users to set
the branch manually, the executor now auto-detects the wiki type by
calling the wiki metadata API and extracts the published branch from the
versions array.
Behaviour:
- If 'branch' is set in front matter config, that value is used as-is
- Otherwise the wiki metadata is fetched; code wikis (type 1) resolve
their published branch automatically
- Project wikis (type 0) continue to work without any branch parameter
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: use warn! for wiki branch auto-detection failures
Elevate log level from debug! to warn! when wiki metadata fetch fails
or when a code wiki has an empty versions array. These silent failures
cause confusing downstream ADO PUT errors that are hard to diagnose.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: fail fast when code wiki branch auto-detection fails
When a code wiki is detected but the published branch cannot be
resolved (empty versions array), return an actionable error instead of
proceeding without versionDescriptor — which would cause a confusing
HTTP 400 from the ADO PUT endpoint.
Also eliminates silent .ok()? chains in the metadata fetch path,
replacing them with explicit warn! logs and graceful fallthrough for
network/parse errors (which may affect project wikis too).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -973,6 +973,7 @@ safe-outputs:
973
973
create-wiki-page:
974
974
wiki-name: "MyProject.wiki" # Required — wiki identifier (name or GUID)
975
975
wiki-project: "OtherProject" # Optional — ADO project that owns the wiki; defaults to current pipeline project
976
+
branch: "main" # Optional — git branch override; auto-detected for code wikis (see note below)
976
977
path-prefix: "/agent-output" # Optional — prepended to the agent-supplied path (restricts write scope)
977
978
title-prefix: "[Agent] " # Optional — prepended to the last path segment (the page title)
978
979
comment: "Created by agent" # Optional — default commit comment when agent omits one
@@ -981,6 +982,8 @@ safe-outputs:
981
982
982
983
Note: `wiki-name`is required. If it is not set, execution fails with an explicit error message.
983
984
985
+
**Code wikis vs project wikis:** The executor automatically detects code wikis (type 1) and resolves the published branch from the wiki metadata. You only need to set `branch` explicitly to override the auto-detected value (e.g. targeting a non-default branch). Project wikis (type 0) need no branch configuration.
986
+
984
987
#### update-wiki-page
985
988
Updates the content of an existing Azure DevOps wiki page. The wiki page must already exist; this tool edits its content but does not create new pages.
986
989
@@ -995,6 +998,7 @@ safe-outputs:
995
998
update-wiki-page:
996
999
wiki-name: "MyProject.wiki" # Required — wiki identifier (name or GUID)
997
1000
wiki-project: "OtherProject" # Optional — ADO project that owns the wiki; defaults to current pipeline project
1001
+
branch: "main" # Optional — git branch override; auto-detected for code wikis (see note below)
998
1002
path-prefix: "/agent-output" # Optional — prepended to the agent-supplied path (restricts write scope)
999
1003
title-prefix: "[Agent] " # Optional — prepended to the last path segment (the page title)
1000
1004
comment: "Updated by agent" # Optional — default commit comment when agent omits one
@@ -1003,6 +1007,8 @@ safe-outputs:
1003
1007
1004
1008
Note: `wiki-name`is required. If it is not set, execution fails with an explicit error message.
1005
1009
1010
+
**Code wikis vs project wikis:** The executor automatically detects code wikis (type 1) and resolves the published branch from the wiki metadata. You only need to set `branch` explicitly to override the auto-detected value (e.g. targeting a non-default branch). Project wikis (type 0) need no branch configuration.
0 commit comments