MCPcopy Create free account
hub / github.com/github/gh-aw / TestAddWorkflowNoGitattributes

Function TestAddWorkflowNoGitattributes

pkg/cli/add_integration_test.go:635–674  ·  view source on GitHub ↗

TestAddWorkflowNoGitattributes tests that --no-gitattributes skips .gitattributes configuration in the add step Note: The compile step may still create .gitattributes, so we check the verbose output instead

(t *testing.T)

Source from the content-addressed store, hash-verified

633// TestAddWorkflowNoGitattributes tests that --no-gitattributes skips .gitattributes configuration in the add step
634// Note: The compile step may still create .gitattributes, so we check the verbose output instead
635func TestAddWorkflowNoGitattributes(t *testing.T) {
636 setup := setupAddIntegrationTest(t)
637 defer setup.cleanup()
638
639 // Create a local workflow file
640 sourceDir := filepath.Join(setup.tempDir, "source-workflows")
641 err := os.MkdirAll(sourceDir, 0755)
642 require.NoError(t, err, "should create source directory")
643
644 localWorkflowPath := filepath.Join(sourceDir, "test.md")
645 localWorkflowContent := `---
646name: Test
647on: workflow_dispatch
648permissions:
649 contents: read
650engine: copilot
651---
652
653# Test
654
655Content.
656`
657 err = os.WriteFile(localWorkflowPath, []byte(localWorkflowContent), 0644)
658 require.NoError(t, err, "should write local workflow file")
659
660 // Add the workflow with --no-gitattributes and --verbose to see output
661 cmd := exec.Command(setup.binaryPath, "add", localWorkflowPath, "--no-gitattributes", "--verbose")
662 cmd.Dir = setup.tempDir
663 output, err := cmd.CombinedOutput()
664 outputStr := string(output)
665
666 t.Logf("Command output:\n%s", outputStr)
667
668 require.NoError(t, err, "add command should succeed: %s", outputStr)
669
670 // Verify the "Configured .gitattributes" message is NOT in the add step output
671 // Note: The compile step may still create .gitattributes, but the add step should skip it
672 assert.NotContains(t, outputStr, "Configured .gitattributes",
673 "add step should NOT configure .gitattributes when --no-gitattributes is set")
674}
675
676// TestAddRemoteWorkflowWithVersion tests adding a remote workflow with a specific version tag
677// Uses the 4+ part format with explicit path since the workflow is in .github/workflows/

Callers

nothing calls this directly

Calls 1

setupAddIntegrationTestFunction · 0.85

Tested by

no test coverage detected