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)
| 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 |
| 635 | func 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 := `--- |
| 646 | name: Test |
| 647 | on: workflow_dispatch |
| 648 | permissions: |
| 649 | contents: read |
| 650 | engine: copilot |
| 651 | --- |
| 652 | |
| 653 | # Test |
| 654 | |
| 655 | Content. |
| 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/ |
nothing calls this directly
no test coverage detected