Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/src/content/docs/reference/aw-yml-package-manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ Missing `README.md` causes package validation to fail.
## Example

```yaml
manifest-version: "1"
min-version: v0.38.0
name: Repo Assist
emoji: 🤖
description: Friendly repository automation for review and issue triage
Expand Down
24 changes: 24 additions & 0 deletions pkg/cli/add_package_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,30 @@ files:
assert.Equal(t, []string{"workflows/review.md"}, pkg.InstallationSource)
})

t.Run("accepts manifest without manifest-version", func(t *testing.T) {
downloadPackageFileFromGitHubForHost = func(owner, repo, path, ref, host string) ([]byte, error) {
switch path {
case "aw.yml":
return []byte(`name: Repo Assist
files:
- workflows/review.md
`), nil
case "README.md":
return []byte("# Repo Assist\n"), nil
default:
return nil, createRepositoryPackageNotFoundError(path)
}
}
listPackageWorkflowFilesForHost = func(owner, repo, ref, workflowPath, host string) ([]string, error) {
t.Fatalf("unexpected scan of %s", workflowPath)
return nil, nil
}

pkg, err := resolveRepositoryPackage(&RepoSpec{RepoSlug: "owner/repo"}, "")
require.NoError(t, err)
assert.Equal(t, []string{"workflows/review.md"}, pkg.InstallationSource)
})

t.Run("rejects unsupported manifest-version", func(t *testing.T) {
downloadPackageFileFromGitHubForHost = func(owner, repo, path, ref, host string) ([]byte, error) {
if path == "aw.yml" {
Expand Down
29 changes: 29 additions & 0 deletions pkg/cli/compile_repository_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,35 @@ engine: copilot
assert.Empty(t, results[0].Errors)
}

func TestCompileWorkflows_AcceptsManifestWithoutManifestVersion(t *testing.T) {
tmpDir := testutil.TempDir(t, "aw-manifest-no-version-*")
originalWd, err := os.Getwd()
require.NoError(t, err)
t.Cleanup(func() { _ = os.Chdir(originalWd) })
require.NoError(t, os.Chdir(tmpDir))

cmd := exec.Command("git", "init")
cmd.Dir = tmpDir
require.NoError(t, cmd.Run())

require.NoError(t, os.MkdirAll(filepath.Join(tmpDir, ".github", "workflows"), 0o755))
require.NoError(t, os.WriteFile(filepath.Join(tmpDir, ".github", "workflows", "test.md"), []byte(`---
on: workflow_dispatch
permissions:
contents: read
engine: copilot
---

# Test
`), 0o644))
require.NoError(t, os.WriteFile(filepath.Join(tmpDir, "README.md"), []byte("# Repo Assist\n"), 0o644))
require.NoError(t, os.WriteFile(filepath.Join(tmpDir, "aw.yml"), []byte(`name: Repo Assist
`), 0o644))

_, err = CompileWorkflows(context.Background(), CompileConfig{})
require.NoError(t, err)
}

func TestCompileWorkflows_RequiresPackageReadme(t *testing.T) {
tmpDir := testutil.TempDir(t, "aw-manifest-readme-*")
originalWd, err := os.Getwd()
Expand Down