(t *testing.T)
| 554 | } |
| 555 | |
| 556 | func TestGetLatestWorkflowEditTimeFromCheckout(t *testing.T) { |
| 557 | t.Parallel() |
| 558 | |
| 559 | tempDir := t.TempDir() |
| 560 | runGit := func(args ...string) { |
| 561 | t.Helper() |
| 562 | cmd := exec.Command("git", args...) |
| 563 | cmd.Dir = tempDir |
| 564 | output, err := cmd.CombinedOutput() |
| 565 | require.NoError(t, err, "git %v failed: %s", args, string(output)) |
| 566 | } |
| 567 | |
| 568 | runGit("init") |
| 569 | runGit("config", "user.name", "Test User") |
| 570 | runGit("config", "user.email", "test@example.com") |
| 571 | |
| 572 | workflowPath := filepath.Join(tempDir, ".github", "workflows", "example.md") |
| 573 | require.NoError(t, os.MkdirAll(filepath.Dir(workflowPath), 0o755)) |
| 574 | require.NoError(t, os.WriteFile(workflowPath, []byte("---\nsource: owner/repo/.github/workflows/example.md@v1\n---\n"), 0o644)) |
| 575 | runGit("add", ".") |
| 576 | runGit("commit", "-m", "add workflow") |
| 577 | |
| 578 | got, err := getLatestWorkflowEditTimeFromCheckout(context.Background(), tempDir, workflowPath) |
| 579 | require.NoError(t, err) |
| 580 | assert.False(t, got.IsZero()) |
| 581 | } |
| 582 | |
| 583 | func TestBuildOrgUpdateIssue(t *testing.T) { |
| 584 | title, body := buildOrgUpdateIssue(orgRepoPreview{ |
nothing calls this directly
no test coverage detected