diff --git a/.github/workflows/maintain-docs.yml b/.github/workflows/maintain-docs.yml index bcecc1c..00dc301 100644 --- a/.github/workflows/maintain-docs.yml +++ b/.github/workflows/maintain-docs.yml @@ -233,7 +233,7 @@ jobs: --arg repo "$GITHUB_REPOSITORY_NAME" \ --arg branch "$INPUT_DOCS_BRANCH" \ --arg baseRef "$INPUT_BASE_REF" \ - '{enabled:true,repo:$repo,clone_url:("https://github.com/" + $repo + ".git"),branch:$branch,branch_prefix:$branch,from:("origin/" + $baseRef)}')" + '{enabled:true,repo:$repo,clone_url:("https://github.com/" + $repo + ".git"),branch:$branch,branch_prefix:$branch,base:$baseRef,from:("origin/" + $baseRef)}')" expected_artifacts="$(printf '%s' "$artifact_declarations" | jq -c 'map(.name)')" output_projections="$(jq -cn --arg path 'metadata.runner_workspace_publication.url' --argjson required "$success_requires_pr" '{docs_agent_publication:{path:$path,required:$required}}')" diff --git a/tests/validate-wp-codebox-run-agent-task-contract.php b/tests/validate-wp-codebox-run-agent-task-contract.php index b3e132c..fcc1c8e 100644 --- a/tests/validate-wp-codebox-run-agent-task-contract.php +++ b/tests/validate-wp-codebox-run-agent-task-contract.php @@ -357,6 +357,18 @@ $assert( array( 'job' => 'prepare', 'output' => 'success_requires_pr' ) === ( $caller_outputs['success_requires_pr'] ?? null ), 'Docs Agent must expose the selected publication policy to consumers.' ); $assert( str_contains( $workflow, 'successRequiresPr:$successRequiresPr' ), 'Docs Agent recipe must retain the selected publication policy.' ); $assert( str_contains( $workflow, '--arg validationDependencies "$INPUT_VALIDATION_DEPENDENCIES"' ), 'Docs Agent recipe must retain caller-owned validation dependencies.' ); +$assert( str_contains( $workflow, '{enabled:true,repo:$repo,clone_url:("https://github.com/" + $repo + ".git"),branch:$branch,branch_prefix:$branch,base:$baseRef,from:("origin/" + $baseRef)}' ), 'Docs Agent runner workspace publication must forward base_ref as base and preserve origin-qualified from.' ); +$runner_workspace_json = shell_exec( "jq -cn --arg repo 'Automattic/example' --arg branch 'docs-agent/docs-upkeep' --arg baseRef 'trunk' '{enabled:true,repo:\$repo,clone_url:(\"https://github.com/\" + \$repo + \".git\"),branch:\$branch,branch_prefix:\$branch,base:\$baseRef,from:(\"origin/\" + \$baseRef)}'" ); +$runner_workspace = json_decode( (string) $runner_workspace_json, true ); +$assert( array( + 'enabled' => true, + 'repo' => 'Automattic/example', + 'clone_url' => 'https://github.com/Automattic/example.git', + 'branch' => 'docs-agent/docs-upkeep', + 'branch_prefix' => 'docs-agent/docs-upkeep', + 'base' => 'trunk', + 'from' => 'origin/trunk', +) === $runner_workspace, 'Docs Agent must emit trunk as publication base and origin/trunk as runner workspace from.' ); preg_match( "/artifact_declarations='(?\[.*?\])'\n/s", $workflow, $artifact_declarations_match ); $assert( isset( $artifact_declarations_match['json'] ), 'Docs Agent must define typed artifact declarations.' );