Skip to content

Commit 8ed3d4b

Browse files
authored
get tool working with content pulled direct from GH (#26)
Signed-off-by: Tom Hennen <[email protected]>
1 parent b89bfda commit 8ed3d4b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sourcetool/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ type repoPolicy struct {
4141
}
4242

4343
func getBranchPolicy(ctx context.Context, gh_client *github.Client, owner string, repo string, branch string) (*protectedBranch, error) {
44-
path := fmt.Sprintf("../policy/github.com/%s/%s/source-policy.json", owner, repo)
44+
path := fmt.Sprintf("policy/github.com/%s/%s/source-policy.json", owner, repo)
4545

4646
policyContents, _, _, err := gh_client.Repositories.GetContents(ctx, SourcePolicyRepoOwner, SourcePolicyRepo, path, nil)
4747
if err != nil {
4848
return nil, err
4949
}
5050

51+
content, err := policyContents.GetContent()
52+
if err != nil {
53+
return nil, err
54+
}
5155
var p repoPolicy
52-
err = json.Unmarshal(policyContents.GetContents(), &p)
56+
err = json.Unmarshal([]byte(content), &p)
5357
if err != nil {
5458
return nil, err
5559
}

0 commit comments

Comments
 (0)