Skip to content

refactor: extract common CLI install/build codegen for maintenance workflow run_operation job#19498

Merged
pelikhan merged 2 commits intomainfrom
copilot/refactor-common-codegen
Mar 4, 2026
Merged

refactor: extract common CLI install/build codegen for maintenance workflow run_operation job#19498
pelikhan merged 2 commits intomainfrom
copilot/refactor-common-codegen

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

The run_operation job's release mode used an ad-hoc gh extension install step while compile_workflows built from source — both with duplicated inline Go strings and compile_workflows pinned to a stale actions/setup-go@v5.1.0 instead of using GetActionPin.

Changes

  • New helpers in maintenance_workflow.go:

    • generateInstallCLISteps(actionMode, version, actionTag) — dev mode emits "Setup Go + Build gh-aw" via GetActionPin; release mode emits an Install gh-aw step using github/gh-aw/actions/setup-cli@<tag>, consistent with how copilot-setup-steps.yml handles release CLI installation
    • getCLICmdPrefix(actionMode) — returns ./gh-aw (dev) or gh aw (release)
  • run_operation refactor: replaces the inline dev/release if-else block with calls to both helpers; release mode no longer uses gh extension install

  • compile_workflows refactor: replaces hardcoded actions/setup-go@v5.1.0 with generateInstallCLISteps, aligning its setup-go pin with run_operation (both now resolve via GetActionPin)

// Before: two separate if/else branches with duplicated YAML strings
if actionMode == ActionModeDev {
    yaml.WriteString(`      - name: Setup Go
        uses: ` + GetActionPin("actions/setup-go") + ` ...`)
} else {
    yaml.WriteString(`      - name: Install gh-aw extension
        run: gh extension install github/gh-aw@` + extensionRef + ` ...`)
}

// After: shared codegen path
yaml.WriteString(generateInstallCLISteps(actionMode, version, actionTag))
yaml.WriteString(`      - name: Run operation
        ...
          GH_AW_CMD_PREFIX: ` + getCLICmdPrefix(actionMode) + ` ...`)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://v-api-github-com.286600.xyz/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw -d 168.63.129.16 git rev-�� --show-toplevel 53 /usr/bin/git ACCEPT GO111MODULE 64/bin/go git (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha GOMODCACHE ache/go/1.25.0/xGO111MODULE /usr/bin/git 2145021/b355/_pkgit GO111MODULE 64/bin/go git bran�� nt/action/git/ref/tags/v999.999.999 go /usr/bin/git fviF/YNsQH08-JrJgit GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha user.name Test User /usr/bin/git &#34;prettier&#34; --wrigit git 64/bin/go git rev-�� --show-toplevel go /usr/bin/git re GO111MODULE 64/bin/go git (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -instructions-test-2888320740/.github/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go l GOMOD GOMODCACHE go env -json l ache/node/24.13.1/x64/bin/node GOINSECURE GOMOD GOMODCACHE git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha runs/20260304-035751-42451/test-1429250693 GO111MODULE 7150097/b401/vet.cfg GOINSECURE GOMOD GOMODCACHE sh -c &#34;prettier&#34; --check &#39;**/*.cjs&#39; &#39;**/*.ts&#39; &#39;**/*.jsOUTPUT l /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu168.63.129.16 GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linuconntrack (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/git prettier --check 64/bin/go git rev-�� --show-toplevel zAo1mM_/ucRcfTiI_9a60CKVjggF /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link ty-test.md scripts/**/*.js 0f07211314e79216--show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha v1.0.0 No/JgktWMlNKvzgJremote.origin.url /usr/bin/git -json GO111MODULE 7ad5fa81c356e69e--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha -test.paniconexit0 -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git rev-�� --show-toplevel erignore 896964/b436/scripts.test -json GO111MODULE 64/bin/go 896964/b436/scripts.test (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha xterm-color -tests /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel erignore /usr/bin/systemd-tmpfiles e=false GO111MODULE 64/bin/go systemd-tmpfiles (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git 614535869/.githugit GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/download-artifact/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha ignore-path ../../../.prettierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha json&#39; --ignore-premote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 3826718947 GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha */*.json&#39; &#39;!../../../pkg/workflo-f credential.username /usr/sbin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ortcfg env 2888c116b4dd41c7GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 6T9Ly10t50BI env -json GO111MODULE 6a2d3f4f797717e2-d GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha /tmp/compile-instructions-test-1380708423/.github/workflows config /usr/bin/git remote.origin.urgit GO111MODULE 64/bin/go git rev-�� --show-toplevel erignore /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha uts.version node /usr/bin/git --write **/*.cjs 64/bin/go git conf�� user.email test@example.com /usr/bin/git prettier --write modules/@npmcli/--show-toplevel git (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --get remote.origin.url ache/node/24.13.1/x64/bin/node -c=4 -nolocalimports -importcfg ache/node/24.13.1/x64/bin/node s-15�� ets.TOKEN }} erignore /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --get remote.origin.url /usr/bin/git --write **/*.cjs 64/bin/go git init�� ../../../.pretti&#34;prettier&#34; --check &#39;**/*.cjs&#39; &#39;**/*.ts&#39; &#39;**/*.jsv1.0.0 node ache/go/1.25.0/x64/pkg/tool/linux_amd64/asm prettier --write 64/bin/go ache/go/1.25.0/x64/pkg/tool/linux_amd64/asm (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha ithub/workflows/archie.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env runs/20260304-035633-30162/test-641827066/.github/workflows GO111MODULE 1/x64/bin/node l GOMOD GOMODCACHE 1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/node GOINSECURE GOMOD GOMODCACHE node (http block)
  • https://v-api-github-com.286600.xyz/repos/actions/upload-artifact/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha ignore-path ../../../.prettierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha ath ../../../.pr**/*.json (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env heck &#39;**/*.cjs&#39; GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 663c484bc4391660bb722ed56b61a0ea-d GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env es.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE node GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ules�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ortcfg k/gh�� 92621063164b9cfcGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE go env y.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha ath ../../../.pr**/*.json (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore (http block)
  • https://v-api-github-com.286600.xyz/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha th .prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 2845399623/.github/workflows GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha th .prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 52/001/test-empty-frontmatter.md GO111MODULE 1/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/sh GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://v-api-github-com.286600.xyz/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go k/gh�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go -t security /usr/bin/git sh -c &#34;prettier&#34; --wriGOINSECURE git 64/bin/go tierignore 53 run-script/lib/n--check node (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go -t security /usr/bin/git sh -c &#34;prettier&#34; --wriGOINSECURE git /node tierignore owner /usr/bin/git node (http block)
  • https://v-api-github-com.286600.xyz/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build624896964/b383/cli.test /tmp/go-build624896964/b383/cli.test -test.testlogfile=/tmp/go-build624896964/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE ortcfg env p/smoke_test_225GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD ode-gyp-bin/node-json ache/go/1.25.0/xGO111MODULE (http block)
    • Triggering command: /tmp/go-build2547150097/b383/cli.test /tmp/go-build2547150097/b383/cli.test -test.testlogfile=/tmp/go-build2547150097/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true --show-toplevel go /usr/bin/git node /hom�� --write **/*.cjs 64/bin/go ; \ else \ echo &#34;golangci-lint is not installed. Run &#39;make deps-dev&#39; to install dependencies.&#34; --ignore-path ../../../.pretti&#34;prettier&#34; --check &#39;**/*.cjs&#39; &#39;**/*.ts&#39; &#39;**/*.json&#39; --ignore-path ../../../.prettierignore sh (http block)
  • https://v-api-github-com.286600.xyz/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name .json...&#34; GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ortcfg k/gh�� b24fc6eead3a6ffdGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD erignore ache/go/1.25.0/xGO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name npx prettier --wGOINSECURE git 64/bin/go --show-toplevel 64/pkg/tool/linuenv /usr/bin/git sh -c &#34;prettier&#34; --wriGOINSECURE git 64/bin/go tierignore 8SCMXiqIP5BEEq6R/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/prettier /usr/bin/git node (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Ensure that the release mode of code generation of the agentic maintenance run_operation job is using the same code generation code to ensure the presence of the cli in the job. See the compile_workflows job and refactor common codegen.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…rkflow run_operation job

- Add generateInstallCLISteps() helper: dev mode builds from source (Setup Go + make build),
  release mode uses setup-cli action (consistent with copilot-setup-steps.yml)
- Add getCLICmdPrefix() helper: returns ./gh-aw in dev mode, gh aw in release mode
- Refactor run_operation job to use both helpers, replacing the inline dev/release if-else
  (release mode now uses setup-cli action instead of gh extension install)
- Refactor compile_workflows job to use generateInstallCLISteps, replacing hardcoded
  actions/setup-go@v5.1.0 pin with GetActionPin() for consistent version with run_operation
- Add tests verifying the codegen behavior and version consistency across both jobs
- Recompile workflows to update agentics-maintenance.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor common code generation for maintenance job refactor: extract common CLI install/build codegen for maintenance workflow run_operation job Mar 4, 2026
@pelikhan pelikhan marked this pull request as ready for review March 4, 2026 04:30
Copilot AI review requested due to automatic review settings March 4, 2026 04:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts duplicated CLI install/build codegen into two shared helper functions (generateInstallCLISteps and getCLICmdPrefix) in maintenance_workflow.go. The run_operation job's release mode previously used a gh extension install step, while compile_workflows used a hardcoded stale actions/setup-go@v5.1.0 pin. Both are now unified through the new helpers that resolve the setup-go version dynamically via GetActionPin.

Changes:

  • Two new helper functions generateInstallCLISteps and getCLICmdPrefix replace inline dev/release if-else blocks in the run_operation and compile_workflows jobs
  • agentics-maintenance.yml regenerated with the updated compile-workflows setup-go pin (v5.1.0 → v6.3.0)
  • New unit tests for both helpers and the refactored codegen paths

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pkg/workflow/maintenance_workflow.go Introduces generateInstallCLISteps and getCLICmdPrefix helpers; refactors run_operation and compile_workflows code generation
pkg/workflow/maintenance_workflow_test.go Adds tests for the two new helper functions and the refactored workflow code generation
.github/workflows/agentics-maintenance.yml Regenerated workflow with updated compile-workflows setup-go pin from v5.1.0 to v6.3.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +338 to 344
yaml.WriteString(generateInstallCLISteps(actionMode, version, actionTag))
yaml.WriteString(` - name: Compile workflows
run: |
./gh-aw compile --validate --verbose
` + getCLICmdPrefix(actionMode) + ` compile --validate --verbose
echo "✓ All workflows compiled successfully"

- name: Setup Scripts
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compile-workflows job was correctly updated to use generateInstallCLISteps, but the sibling zizmor-scan job (which also runs in dev mode, in the same if (actionMode == ActionModeDev) block) was left with a hardcoded actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 and a direct ./gh-aw invocation. This leaves the zizmor-scan job using a stale setup-go pin inconsistent with run_operation and compile-workflows. The zizmor-scan job should also use generateInstallCLISteps(actionMode, version, actionTag) and getCLICmdPrefix(actionMode) to stay consistent, which is the primary goal of this refactoring.

Copilot uses AI. Check for mistakes.

// getCLICmdPrefix returns the CLI command prefix based on action mode.
// In dev mode: "./gh-aw" (local binary built from source)
// In release mode: "gh aw" (installed via gh extension)
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment for getCLICmdPrefix says "In release mode: 'gh aw' (installed via gh extension)" but this PR changed the release mode installation from gh extension install to the setup-cli action. The comment should say "installed via setup-cli action" instead of "installed via gh extension".

Suggested change
// In release mode: "gh aw" (installed via gh extension)
// In release mode: "gh aw" (installed via setup-cli action)

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit b7f56a6 into main Mar 4, 2026
110 checks passed
@pelikhan pelikhan deleted the copilot/refactor-common-codegen branch March 4, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants