Skip to content
Open
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
6 changes: 3 additions & 3 deletions example/actionpermissions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {

fmt.Printf("Current ActionsPermissions %v\n", actionsPermissionsRepository)

actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("selected")}
actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("selected")}
_, _, err = client.Repositories.UpdateActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository)
if err != nil {
log.Fatal(err)
Expand All @@ -62,15 +62,15 @@ func main() {

fmt.Printf("Current ActionsAllowed %v\n", actionsAllowed)

actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: github.Ptr(true), VerifiedAllowed: github.Ptr(false), PatternsAllowed: []string{"a/b"}}
actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}}
_, _, err = client.Repositories.EditActionsAllowed(ctx, *owner, *name, *actionsAllowed)
if err != nil {
log.Fatal(err)
}

fmt.Printf("Current ActionsAllowed %v\n", actionsAllowed)

actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("all")}
actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("all")}
_, _, err = client.Repositories.UpdateActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository)
if err != nil {
log.Fatal(err)
Expand Down
6 changes: 3 additions & 3 deletions example/commitpr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func getTree(ref *github.Reference) (tree *github.Tree, err error) {
if err != nil {
return nil, err
}
entries = append(entries, &github.TreeEntry{Path: &file, Type: github.Ptr("blob"), Content: github.Ptr(string(content)), Mode: github.Ptr("100644")})
entries = append(entries, &github.TreeEntry{Path: &file, Type: new("blob"), Content: new(string(content)), Mode: new("100644")})
}

tree, _, err = client.Git.CreateTree(ctx, *sourceOwner, *sourceRepo, *ref.Object.SHA, entries)
Expand Down Expand Up @@ -173,7 +173,7 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) {
ref.Object.SHA = newCommit.SHA
_, _, err = client.Git.UpdateRef(ctx, *sourceOwner, *sourceRepo, *ref.Ref, github.UpdateRef{
SHA: *newCommit.SHA,
Force: github.Ptr(false),
Force: new(false),
})
return err
}
Expand All @@ -200,7 +200,7 @@ func createPR() (err error) {
HeadRepo: repoBranch,
Base: *prBranch,
Body: prDescription,
MaintainerCanModify: github.Ptr(true),
MaintainerCanModify: new(true),
}

pr, _, err := client.PullRequests.Create(ctx, *prRepoOwner, *prRepo, newPR)
Expand Down
2 changes: 1 addition & 1 deletion example/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/google/go-github/v90/example

go 1.25.8
go 1.26.0

require (
github.com/ProtonMail/go-crypto v1.4.1
Expand Down
2 changes: 1 addition & 1 deletion example/newfilewithappauth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func main() {
"example/foo.txt",
&github.RepositoryContentFileOptions{
Content: []byte("foo"),
Message: github.Ptr("sample commit"),
Message: new("sample commit"),
SHA: nil,
},
)
Expand Down
16 changes: 8 additions & 8 deletions github/actions_artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestActionsService_ListArtifacts(t *testing.T) {
})

opts := &ListArtifactsOptions{
Name: Ptr("TheArtifact"),
Name: new("TheArtifact"),
ListOptions: ListOptions{Page: 2},
}
ctx := t.Context()
Expand All @@ -41,7 +41,7 @@ func TestActionsService_ListArtifacts(t *testing.T) {
t.Errorf("Actions.ListArtifacts returned error: %v", err)
}

want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(int64(1))}}}
want := &ArtifactList{TotalCount: new(int64(1)), Artifacts: []*Artifact{{ID: new(int64(1))}}}
if !cmp.Equal(artifacts, want) {
t.Errorf("Actions.ListArtifacts returned %+v, want %+v", artifacts, want)
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestActionsService_ListWorkflowRunArtifacts(t *testing.T) {
t.Errorf("Actions.ListWorkflowRunArtifacts returned error: %v", err)
}

want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(int64(1))}}}
want := &ArtifactList{TotalCount: new(int64(1)), Artifacts: []*Artifact{{ID: new(int64(1))}}}
if !cmp.Equal(artifacts, want) {
t.Errorf("Actions.ListWorkflowRunArtifacts returned %+v, want %+v", artifacts, want)
}
Expand Down Expand Up @@ -205,11 +205,11 @@ func TestActionsService_GetArtifact(t *testing.T) {
}

want := &Artifact{
ID: Ptr(int64(1)),
NodeID: Ptr("xyz"),
Name: Ptr("a"),
SizeInBytes: Ptr(int64(5)),
ArchiveDownloadURL: Ptr("u"),
ID: new(int64(1)),
NodeID: new("xyz"),
Name: new("a"),
SizeInBytes: new(int64(5)),
ArchiveDownloadURL: new("u"),
}
if !cmp.Equal(artifact, want) {
t.Errorf("Actions.GetArtifact returned %+v, want %+v", artifact, want)
Expand Down
14 changes: 7 additions & 7 deletions github/actions_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestActionsService_ListCaches(t *testing.T) {
t.Errorf("Actions.ListCaches returned error: %v", err)
}

want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: Ptr(int64(1))}}}
want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: new(int64(1))}}}
if !cmp.Equal(cacheList, want) {
t.Errorf("Actions.ListCaches returned %+v, want %+v", cacheList, want)
}
Expand Down Expand Up @@ -105,19 +105,19 @@ func TestActionsService_DeleteCachesByKey(t *testing.T) {
})

ctx := t.Context()
_, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main"))
_, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main"))
if err != nil {
t.Errorf("Actions.DeleteCachesByKey return error: %v", err)
}

const methodName = "DeleteCachesByKey"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.DeleteCachesByKey(ctx, "\n", "\n", "\n", Ptr("\n"))
_, err = client.Actions.DeleteCachesByKey(ctx, "\n", "\n", "\n", new("\n"))
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main"))
return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main"))
})
}

Expand All @@ -126,7 +126,7 @@ func TestActionsService_DeleteCachesByKey_invalidOwner(t *testing.T) {
client, _, _ := setup(t)

ctx := t.Context()
_, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", Ptr("main"))
_, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", new("main"))
testURLParseError(t, err)
}

Expand All @@ -135,7 +135,7 @@ func TestActionsService_DeleteCachesByKey_invalidRepo(t *testing.T) {
client, _, _ := setup(t)

ctx := t.Context()
_, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", Ptr("main"))
_, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", new("main"))
testURLParseError(t, err)
}

Expand All @@ -149,7 +149,7 @@ func TestActionsService_DeleteCachesByKey_notFound(t *testing.T) {
})

ctx := t.Context()
resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main"))
resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main"))
if err == nil {
t.Error("Expected HTTP 404 response")
}
Expand Down
Loading
Loading