Skip to content

Improve test quality in pkg/cli/actions_test.go#29972

Merged
pelikhan merged 2 commits intomainfrom
copilot/improve-test-quality-actions-test-go
May 3, 2026
Merged

Improve test quality in pkg/cli/actions_test.go#29972
pelikhan merged 2 commits intomainfrom
copilot/improve-test-quality-actions-test-go

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

actions_test.go used manual map comparison loops instead of testify assertions, making failure output hard to read and inconsistent with the rest of the codebase.

Changes

  • Replaced manual map comparison with assert.Equal — produces structured diffs on failure instead of per-key error messages
  • Added testify import (assert)
  • Added 3 edge case tests:
    • non-map input returns empty map — non-map[string]any input (e.g. a slice) is handled gracefully
    • env variable not in metadata and key differs from token name${SOME_TOKEN} under key MY_KEY defaults to secrets.SOME_TOKEN
    • existing github actions env syntax is preserved unchanged${{ env.* }} passthrough, complementing the existing ${{ secrets.* }} case

Before:

if len(result) != len(tt.expected) {
    t.Errorf("Expected %d environment variables, got %d", len(tt.expected), len(result))
}
for key, expectedValue := range tt.expected {
    if actualValue, exists := result[key]; !exists {
        t.Errorf("Expected key '%s' not found in result", key)
    } else if actualValue != expectedValue {
        t.Errorf("For key '%s', expected '%s', got '%s'", key, expectedValue, actualValue)
    }
}

After:

assert.Equal(t, tt.expected, result, "convertToGitHubActionsEnv should produce the expected environment variable map")

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://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm env /ref/tags/v9.0.0 GO111MODULE sv GOINSECURE 6311917/b006/ GOMODCACHE ache/go/1.25.8/x-buildtags (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 til GOMODCACHE x_amd64/link env pC4FS5t0C GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE fips140deps/godeinit GOMODCACHE J_/CWrYu2czG7Ca7ylQP4Z8/vCNYLdc7D8RXanEmFBss (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 GOMOD GOMODCACHE odp3IL84tZKq5R-8Dk/Exs2fuW_hbdM5test@example.com env 1702794952/001 sRemoteWithRealGitmaster_branch1227609905/002/work g_.a GOINSECURE /execenv GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuInitial commit (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/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, .object.type] | @tsv --show-toplevel /opt/hostedtoolcache/go/1.25.8/x-buildtags /usr/bin/git runs/20260503-17git -trimpath /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolc--jq /usr/bin/git tructions-test-2gh -buildtags /usr/bin/infocmp/repos/actions/github-script/git/ref/tags/v9 git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv GOMODCACHE x_amd64/vet /usr/bin/git -json /" + .name 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/asm /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git ErrorFormatting3git remote /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel node /usr/bin/git s/test.md go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9 infocmp bject.type] | @tsv r-test3410474926git r-test3410474926rev-parse /usr/bin/gh git rev-�� /ref/tags/v9 gh sv runs/20260503-17infocmp --jq /usr/bin/git gh (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv SameOutput2280325548/001/stability-test.md -trimpath 1/x64/bin/node -p internal/runtimerev-parse -lang=go1.25 /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linuremote.origin.url t-ha�� ithub/workflows/ab-testing-advisor.md '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitbranch_with_hyphen2422696910/001' 1/x64/bin/node -p github.com/githu-1 -lang=go1.25 1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x64/pkg/tool/linu--jq (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel infocmp /usr/bin/git xterm-color ache/go/1.25.8/xrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/infocmp --show-toplevel ache/go/1.25.8/xrev-parse /usr/bin/git infocmp (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv == 'true' && 'full-sweep (enforce_all)' l /usr/lib/git-core/git go1.25.8 -c=4 -nolocalimports /usr/lib/git-core/git unpa�� --pack_header=2,3 -q /opt/hostedtoolcache/node/24.14.1/x64/bin/node -json GO111MODULE 64/bin/go node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv xterm-color /home/REDACTED/work/gh-aw/gh-aw/pkg/fileutil/tar.go epo.git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel s/3/artifacts (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv --show-toplevel go /usr/bin/git -json GO111MODULE x_amd64/compile git conf�� --get remote.origin.url /usr/bin/git -json GO111MODULE x_amd64/compile git (http block)
  • https://api.github.com/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, .object.type] | @tsv --show-toplevel gh /usr/bin/infocmp /repos/github/ghgh (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build1406311917/b241/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/x/text@v0.36.0/internal/language/common.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build1406311917/b131/importcfg -pack /home/REDACTED/go/pkg/mod/github.com/modelcontextprotocol/go-sdk@v1.5.0/mcp/client.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9.0.0
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build1406311917/b233/importcfg -pack /home/REDACTED/go/pkg/mod/github.com/yosida95/uritemplate/v3@v3.0.2/compile.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build1406311917/b237/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/x/text@v0.36.0/message/catalog.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv ." GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE -3lxG0HoYBiF env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/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, .object.type] | @tsv xterm-color ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -json aFt_/WeZ-gWqCt5Yapi /opt/hostedtoolc/repos/actions/github-script/git/ref/tags/v9 git rev-�� --show-toplevel /opt/hostedtoolc-test.v=true /usr/bin/git 6311917/b192/impgit -trimpath 5679872/b408/vet--show-toplevel git (http block)
  • https://api.github.com/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, .object.type] | @tsv -stringintconv -tests (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -json DxwQ/E_kI_tUUioJapi 64/pkg/tool/linu/repos/actions/github-script/git/ref/tags/v9 git rev-�� --show-toplevel 64/pkg/tool/linu-buildtags /usr/bin/git 6311917/b189/impgit -trimpath 5679872/b409/vet--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel infocmp /usr/bin/infocmp xterm-color l /usr/bin/git infocmp -1 xterm-color git /usr/bin/git /tmp/compile-allinfocmp show /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv runs/20260503-173448-38248/test--f remote t l -c=4 -nolocalimports /usr/lib/git-core/git --gi�� for-each-ref --format=%(objectname) /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/v6 --jq [.object.sha, .object.type] | @tsv --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git remo�� GOMODCACHE s/5/artifacts /usr/bin/git -json GO111MODULE x_amd64/asm git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv --show-toplevel x_amd64/compile om/myorg/myrepo.git -json GO111MODULE x_amd64/compile node /tmp�� /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/api-consumption-report.md x_amd64/compile /opt/hostedtoolcache/node/24.14.1/x64/bin/node -json GO111MODULE x_amd64/compile /opt/hostedtoolcache/node/24.14.1/x64/bin/node (http block)
  • https://api.github.com/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, .object.type] | @tsv GOMODCACHE x_amd64/compile /usr/bin/git -json l/errors/error.grev-parse x_amd64/compile git init�� GOMODCACHE x_amd64/compile /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
  • https://api.github.com/repos/aws-actions/configure-aws-credentials/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9 git bject.type] | @tsv --show-toplevel l e/git git rev-�� --show-toplevel e/git /usr/bin/git /tmp/TestHashStagh go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git --git-dir go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/gh --show-toplevel l /usr/bin/git gh (http block)
  • https://api.github.com/repos/azure/login/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/azure/login/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git :latest /tmp/go-build263rev-parse /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-f /usr/bin/git /tmp/go-build263infocmp -trimpath /usr/bin/git git (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git k/gh-aw/gh-aw/.ggit -trimpath /opt/hostedtoolc--show-toplevel git rev-�� /ref/tags/v9 /opt/hostedtoolcache/go/1.25.8/x--jq sv s/test.md -importcfg /opt/hostedtoolcxterm-color git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq [.object.sha, .object.type] | @tsv /repos/actions/github-script/git/ref/tags/v9 --jq /usr/bin/git ExpressionCompilgh k/gh-aw/gh-aw/pkapi /opt/hostedtoolc/repos/actions/github-script/git/ref/tags/v9 git rev-�� --show-toplevel /opt/hostedtoolccurrent (local changes) /usr/bin/infocmp /ref/tags/v9 k/gh-aw/gh-aw/pk-1 sv infocmp (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv xterm-color x_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/agent-persona-explorer.md x_amd64/compile /usr/bin/gh -json GO111MODULE x_amd64/compile gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq .cfg ub/workflows GO111MODULE x_amd64/compile git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-26 GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com env g_.a l.go 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD abis 64/pkg/tool/linuInitial commit (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-03 GOMOD GOMODCACHE 64/pkg/tool/linuTest User env g_.a 0/internal/language/compact/compact.go x_amd64/link GOINSECURE GOMOD abis x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-02-02 GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile eWit�� g_.a 0/internal/internal.go 64/pkg/tool/linux_amd64/compile GOINSECURE al_wasm.o 64/src/internal/--oneline 64/pkg/tool/linu-1 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name PcfUGjA_S ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE g GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-importcfg env 2507408646 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linu-buildmode=exe GOINSECURE 6311917/b012/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE XrJ3zu1-VlOgyLsNrev-parse GOMODCACHE 64/pkg/tool/linux_amd64/compile ortc�� 3735943097 64/src/net/addrselect.go ache/go/1.25.8/x64/pkg/tool/linu--limit GOINSECURE erutil GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name InX8DV7o_ ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE age GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm env 5548/001/stability-test.md GO111MODULE x_amd64/vet GOINSECURE 6311917/b013/ GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 bbyq8rTOi ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE erutil GOMODCACHE 06/m1mI9m8ZybBw5VAsfaec/Pi1C9UCl--jq env 269249750 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 6311917/b013/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1234567890
    • Triggering command: /usr/bin/gh gh api repos/{owner}/{repo}/actions/runs/1234567890 --jq {databaseId: .id, number: .run_number, url: .html_url, status: .status, conclusion: .conclusion, workflowName: .name, workflowPath: .path, createdAt: .created_at, startedAt: .run_started_at, updatedAt: .updated_at, event: .event, headBranch: .head_branch, -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name KjIdi_zAe x_amd64/link GOINSECURE pguts GOMODCACHE x_amd64/link env ortcfg N5EVshPW9 ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE e/rtcov GOMODCACHE j0/8-8vmLiYCmHH9yLNKNaz/um86pbnuaZfPHtRi8CIm (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 DfcRFzBGz util.test GOINSECURE onpins GOMODCACHE util.test 6356�� BQHnSspmX GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE record GOMODCACHE ache/go/1.25.8/xremote.origin.url (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name bBouUBHdz ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x--json env 2507408646 GO111MODULE ache/go/1.25.8/x--created GOINSECURE 6311917/b012/ GOMODCACHE ache/go/1.25.8/xorigin (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 NG8R67gve 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env 01/main.md GO111MODULE ache/go/1.25.8/x64/pkg/tool/linu-nolocalimports GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2635679872/b452/_testmain.go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name fG0BeREzZ ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE g GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm env 2507408646 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 6311917/b015/ GOMODCACHE ache/go/1.25.8/xTest User (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 diXaaNED5 x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env ortcfg GO111MODULE k GOINSECURE fips140/alias GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name YfB4YDUdE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE t GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse env F769rPpYG GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE /gc GOMODCACHE ache/go/1.25.8/xtest@example.com (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 Kt0zQSK0W ache/go/1.25.8/x64/pkg/tool/linu-buildmode=exe GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2635679872/b112/vet.cfg env 3735943097 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name J9_2Hh5RJ ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 verutil_test.go ache/go/1.25.8/x64/pkg/tool/linu-lang=go1.25 GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-goversion ortc�� 3735943097 om/segmentio/encoding@v0.5.4/asc-nolocalimports ache/go/1.25.8/x64/pkg/tool/linu-importcfg GOINSECURE 6311917/b047/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/pkg/timeutil/format_test.go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD s 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 x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD ic/asm.s 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 6 GOMOD GOMODCACHE go env ortcfg yi2fVdpoL ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xtest@example.com (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build2635679872/b404/cli.test /tmp/go-build2635679872/b404/cli.test -test.testlogfile=/tmp/go-build2635679872/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -nolocalimports -importcfg /tmp/go-build1406311917/b205/importcfg -pack env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq [.object.sha, .object.type] | @tsv --show-toplevel gh /usr/bin/git /repos/actions/gbasename --jq ache/node/24.14.1/x64/bin/node git rev-�� --show-toplevel ache/node/24.14.1/x64/bin/node /usr/bin/gh b.actor }}, Repogh config /usr/bin/git gh (http block)
  • https://api.github.com/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, .object.type] | @tsv DefaultBranchFromLsRemoteWithRealGitmain_branch2500242751/001' DefaultBranchFromLsRemoteWithRealGitmain_branch2500242751/001' ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env 6311917/b218/_pkg_.a GO111MODULE 6311917/b218=> GOINSECURE g/x/text/unicoderev-parse GOMODCACHE git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env ub/workflows GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env ub/workflows GO111MODULE x_amd64/vet GOINSECURE GOMOD emclr_wasm.s x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE aWTPZmVH_ghz env ub/workflows GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD ys_wasm.s go (http block)
  • https://api.github.com/repos/google-github-actions/auth/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/google-github-actions/auth/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel infocmp /usr/bin/git k/gh-aw/gh-aw/.ggit eIF_E5paMIS4 /usr/bin/gh git rev-�� --show-toplevel gh /usr/bin/git runs/20260503-17git --jq /usr/bin/git git (http block)
  • https://api.github.com/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, .object.type] | @tsv ortcfg GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE fips140 GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env 3448-38248/test-2309154233/.github/workflows i2Jk/kxQktkbJrdZm0O72i2Jk 6311917/b219=> GOINSECURE g/x/text/unicodeconfig GOMODCACHE /opt/hostedtoolcremote.origin.url (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm env 3418447770/.github/workflows GO111MODULE sv GOINSECURE 6311917/b011/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/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 env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE racev2 GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url ortc�� DefaultBranchFromLsRemoteWithRealGitbranch_with_hyphen2422696910/001' DefaultBranchFromLsRemoteWithRealGitbranch_with_hyphen2422696910/001' ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE ntio/encoding/isremote GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/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 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch 0/001/noflag-a.md GO111MODULE .cfg GOINSECURE 6311917/b011/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2635679872/b459/_testmain.go env /ref/tags/v9 GO111MODULE sv GOINSECURE 6311917/b011/rt0pull ache/go/1.25.8/xtest/race-image:v1.0.0 ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)

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

…e cases

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2806a7b9-210d-4c32-80be-c9e34a912692

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test quality for ./pkg/cli/actions_test.go Improve test quality in pkg/cli/actions_test.go May 3, 2026
Copilot AI requested a review from gh-aw-bot May 3, 2026 17:38
@pelikhan pelikhan marked this pull request as ready for review May 3, 2026 18:11
Copilot AI review requested due to automatic review settings May 3, 2026 18:11
Copy link
Copy Markdown
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 improves the readability and consistency of convertToGitHubActionsEnv tests in pkg/cli/actions_test.go by replacing manual map comparisons with testify/assert and adding a few edge-case scenarios.

Changes:

  • Replaced manual result-map comparison logic with a single assert.Equal assertion.
  • Added edge-case tests for non-map input, token-name/key mismatch fallback behavior, and preserving existing ${{ env.* }} syntax.
  • Added the testify/assert import used by the updated test assertions.
Show a summary per file
File Description
pkg/cli/actions_test.go Simplifies assertions and expands test coverage for convertToGitHubActionsEnv.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

🧪 Test Quality Sentinel Report

Test Quality Score: 98/100

Excellent test quality

Metric Value
New/modified tests analyzed 3 new table rows in TestConvertToGitHubActionsEnv
✅ Design tests (behavioral contracts) 3 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 3 (100%)
Duplicate test clusters 0
Test inflation detected No (pure test-quality improvement, no production code changed)
🚨 Coding-guideline violations None

Test Classification Details

Test File Classification Issues Detected
"non-map input returns empty map" pkg/cli/actions_test.go ✅ Design Edge case: non-map input type gracefully returns empty map
"env variable not in metadata and key differs from token name" pkg/cli/actions_test.go ✅ Design Behavioral: verifies secret token name substitution logic
"existing github actions env syntax is preserved unchanged" pkg/cli/actions_test.go ✅ Design Behavioral: verifies idempotency of ${{ env.* }} syntax

What Changed

Beyond adding 3 new test rows, the PR also:

  • Migrated to testify/assert: The manual if len(result) != len(tt.expected) + per-key loop was replaced with assert.Equal(t, tt.expected, result, "descriptive message") — cleaner and catches mismatches in a single assertion with a full diff. ✅
  • Assertion message present: "convertToGitHubActionsEnv should produce the expected environment variable map" satisfies the guideline requirement. ✅
  • Build tag present: //go:build !integration on line 1. ✅
  • No mock libraries used. ✅

New Test Analysis

All three new rows verify observable output of convertToGitHubActionsEnv — the exact values in the returned map[string]string. Each covers a distinct input shape:

  1. Edge case input type: []string{...} (not a map[string]any) → expects empty map. Confirms the function handles unexpected input types gracefully.
  2. Empty metadata, key≠token name: Confirms fallback to ${{ secrets.TOKEN_NAME }} when the token name is not found in metadata.
  3. Pre-existing ${{ env.* }} syntax: Confirms idempotency — already-converted values pass through unchanged.

All three rows belong to the existing table-driven test TestConvertToGitHubActionsEnv, which is the preferred pattern in this codebase.


Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 3 new table rows (unit, //go:build !integration)
  • 🟨 JavaScript (*.test.cjs, *.test.js): 0 tests changed

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). All three new test rows verify behavioral contracts with observable output assertions and meaningful edge cases. The assertion refactor to assert.Equal with a descriptive message further improves test readability.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §25286840563

🧪 Test quality analysis by Test Quality Sentinel · ● 848K ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 98/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). All 3 new table rows are behavioral contracts testing observable output of convertToGitHubActionsEnv, including an edge case for non-map input. Build tag, assertion messages, and no mock libraries all satisfy project guidelines.

@github-actions github-actions Bot mentioned this pull request May 3, 2026
@pelikhan pelikhan merged commit 4353c5a into main May 3, 2026
41 checks passed
@pelikhan pelikhan deleted the copilot/improve-test-quality-actions-test-go branch May 3, 2026 18:29
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.

[testify-expert] Improve Test Quality: ./pkg/cli/actions_test.go

4 participants