Skip to content

Commit d129c57

Browse files
authored
Merge branch 'main' into copilot/fix-copilot-access-azure-apis
2 parents 6ed36b2 + a6dfd4c commit d129c57

File tree

7 files changed

+43
-3
lines changed

7 files changed

+43
-3
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,32 @@ jobs:
557557
path: gh-aw
558558
retention-days: 14
559559

560+
- name: Report binary download instructions
561+
run: |
562+
RUN_ID="${{ github.run_id }}"
563+
REPO="${{ github.repository }}"
564+
echo "## 📦 gh-aw Binary" >> $GITHUB_STEP_SUMMARY
565+
echo "" >> $GITHUB_STEP_SUMMARY
566+
echo "The \`gh-aw\` Linux (amd64) binary has been uploaded as an artifact." >> $GITHUB_STEP_SUMMARY
567+
echo "" >> $GITHUB_STEP_SUMMARY
568+
echo "### Download with GitHub CLI" >> $GITHUB_STEP_SUMMARY
569+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
570+
echo "gh run download ${RUN_ID} --repo ${REPO} --name gh-aw-linux-amd64" >> $GITHUB_STEP_SUMMARY
571+
echo "chmod +x gh-aw" >> $GITHUB_STEP_SUMMARY
572+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
573+
echo "" >> $GITHUB_STEP_SUMMARY
574+
echo "### Download with curl" >> $GITHUB_STEP_SUMMARY
575+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
576+
echo "# Requires a GitHub token with actions:read scope" >> $GITHUB_STEP_SUMMARY
577+
echo "ARTIFACT_ID=\$(curl -fsSL -H \"Authorization: Bearer \$GH_TOKEN\" \\" >> $GITHUB_STEP_SUMMARY
578+
echo " \"https://api.github.com/repos/${REPO}/actions/runs/${RUN_ID}/artifacts\" \\" >> $GITHUB_STEP_SUMMARY
579+
echo " | jq -r '.artifacts[] | select(.name==\"gh-aw-linux-amd64\") | .id')" >> $GITHUB_STEP_SUMMARY
580+
echo "curl -fsSL -H \"Authorization: Bearer \$GH_TOKEN\" \\" >> $GITHUB_STEP_SUMMARY
581+
echo " -L \"https://api.github.com/repos/${REPO}/actions/artifacts/\$ARTIFACT_ID/zip\" \\" >> $GITHUB_STEP_SUMMARY
582+
echo " -o gh-aw-linux-amd64.zip" >> $GITHUB_STEP_SUMMARY
583+
echo "unzip gh-aw-linux-amd64.zip && chmod +x gh-aw" >> $GITHUB_STEP_SUMMARY
584+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
585+
560586
- name: Rebuild lock files
561587
run: make recompile
562588
env:

docs/src/content/docs/setup/cli.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ Commands that support `--create-pull-request` (such as `gh aw add`, `gh aw add-w
7979

8080
`gh aw audit` and `gh aw add-wizard` also auto-detect the GHES host from the git remote, so running them inside a GHES repository works without setting `GH_HOST` manually.
8181

82-
#### Configuring `gh` CLI in workflow steps on GHES
82+
#### Configuring `gh` CLI on GHES
8383

84-
When agentic workflows run on GitHub Enterprise Server and use custom `steps:` that invoke `gh` CLI commands, source the bundled helper script to configure `gh` for the enterprise host:
84+
The compiled agent job automatically runs `configure_gh_for_ghe.sh` before the agent starts executing. The script detects the GitHub host from the `GITHUB_SERVER_URL` environment variable (set by GitHub Actions on GHES) and configures `gh` to authenticate against it. No configuration is required for the agent to use `gh` CLI commands on your GHES instance.
85+
86+
For custom `steps:` that run outside the agent sandbox (for example, pre-agent data gathering or post-agent reporting), source the helper script manually:
8587

8688
```yaml wrap
8789
steps:
@@ -96,7 +98,7 @@ steps:
9698
gh pr list --state open --limit 200 --json number,title
9799
```
98100

99-
The script automatically detects the GitHub host from the `GITHUB_SERVER_URL` environment variable (set by GitHub Actions on GHES) and configures `gh` to authenticate against it. No manual configuration is needed for standard GHES deployments. The script is installed to `/opt/gh-aw/actions/configure_gh_for_ghe.sh` by the setup action.
101+
The script is installed to `/opt/gh-aw/actions/configure_gh_for_ghe.sh` by the setup action.
100102

101103
> [!NOTE]
102104
> Custom steps run outside the agent firewall sandbox and have access to standard GitHub Actions environment variables including `GITHUB_SERVER_URL`, `GITHUB_TOKEN`, and `GH_TOKEN`.

pkg/cli/codemod_github_app.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func hasDeprecatedAppField(frontmatter map[string]any) bool {
3737
if githubAny, hasGitHub := toolsMap["github"]; hasGitHub {
3838
if githubMap, ok := githubAny.(map[string]any); ok {
3939
if _, hasApp := githubMap["app"]; hasApp {
40+
githubAppCodemodLog.Print("Deprecated 'app' field found in tools.github")
4041
return true
4142
}
4243
}
@@ -48,6 +49,7 @@ func hasDeprecatedAppField(frontmatter map[string]any) bool {
4849
if soAny, hasSO := frontmatter["safe-outputs"]; hasSO {
4950
if soMap, ok := soAny.(map[string]any); ok {
5051
if _, hasApp := soMap["app"]; hasApp {
52+
githubAppCodemodLog.Print("Deprecated 'app' field found in safe-outputs")
5153
return true
5254
}
5355
}
@@ -57,13 +59,15 @@ func hasDeprecatedAppField(frontmatter map[string]any) bool {
5759
if checkoutAny, hasCheckout := frontmatter["checkout"]; hasCheckout {
5860
if checkoutMap, ok := checkoutAny.(map[string]any); ok {
5961
if _, hasApp := checkoutMap["app"]; hasApp {
62+
githubAppCodemodLog.Print("Deprecated 'app' field found in checkout")
6063
return true
6164
}
6265
}
6366
if checkoutArr, ok := checkoutAny.([]any); ok {
6467
for _, item := range checkoutArr {
6568
if itemMap, ok := item.(map[string]any); ok {
6669
if _, hasApp := itemMap["app"]; hasApp {
70+
githubAppCodemodLog.Print("Deprecated 'app' field found in checkout array item")
6771
return true
6872
}
6973
}

pkg/workflow/compiler_yaml_ai_execution.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
func (c *Compiler) generateEngineExecutionSteps(yaml *strings.Builder, data *WorkflowData, engine CodingAgentEngine, logFile string) {
1010

1111
steps := engine.GetExecutionSteps(data, logFile)
12+
compilerYamlLog.Printf("Generating engine execution steps: engine=%s, steps=%d", engine.GetID(), len(steps))
1213

1314
for _, step := range steps {
1415
for _, line := range step {

pkg/workflow/github_tool_to_toolset.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func init() {
2222
if err := json.Unmarshal(githubToolToToolsetJSON, &GitHubToolToToolsetMap); err != nil {
2323
panic("failed to load GitHub tool to toolset mapping: " + err.Error())
2424
}
25+
githubToolToToolsetLog.Printf("Loaded GitHub tool-to-toolset mapping: %d entries", len(GitHubToolToToolsetMap))
2526
}
2627

2728
// GitHubToolToToolsetMap is the last declaration in this file; ValidateGitHubToolsAgainstToolsets

pkg/workflow/lock_schema.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ func formatSupportedVersions() string {
8787
// GenerateLockMetadata creates a LockMetadata struct for embedding in lock files
8888
// For release builds, the compiler version is included in the metadata
8989
func GenerateLockMetadata(frontmatterHash string, stopTime string, strict bool) *LockMetadata {
90+
lockSchemaLog.Printf("Generating lock metadata: schema=%s, strict=%t, hasStopTime=%t", LockSchemaV2, strict, stopTime != "")
91+
9092
metadata := &LockMetadata{
9193
SchemaVersion: LockSchemaV2,
9294
FrontmatterHash: frontmatterHash,
@@ -97,6 +99,7 @@ func GenerateLockMetadata(frontmatterHash string, stopTime string, strict bool)
9799
// Include compiler version only for release builds
98100
if IsRelease() {
99101
metadata.CompilerVersion = GetVersion()
102+
lockSchemaLog.Printf("Including compiler version in lock metadata: %s", metadata.CompilerVersion)
100103
}
101104

102105
return metadata

pkg/workflow/safe_outputs_config_helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ func generateHideCommentConfig(max *string, defaultMax int, allowedReasons []str
199199
// - "allowed_repos" uses underscore to match JavaScript handler expectations (see repo_helpers.cjs)
200200
// This inconsistency is intentional to maintain compatibility with existing handler code.
201201
func generateTargetConfigWithRepos(targetConfig SafeOutputTargetConfig, max *string, defaultMax int, additionalFields map[string]any) map[string]any {
202+
safeOutputsConfigGenLog.Printf("Generating target config: target=%s, targetRepo=%s, allowedReposCount=%d, additionalFieldsCount=%d",
203+
targetConfig.Target, targetConfig.TargetRepoSlug, len(targetConfig.AllowedRepos), len(additionalFields))
204+
202205
config := generateMaxConfig(max, defaultMax)
203206

204207
// Add target if specified

0 commit comments

Comments
 (0)