Monorepo for Tangled tangled.org
856
fork

Configure Feed

Select the types of activity you want to include in your feed.

knotserver: create a fork PR link #341

open opened by willdot.net targeting master from willdot.net/tangled-fork: fork-pr-command

This should allow the PR link when pushing, to cater for forks.

Full disclosure, I haven't tested this because I can't get my local knot setup to work properly 🫠

Signed-off-by: Will Andrews did:plc:dadhhalkfcq3gucaq25hjqon

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:dadhhalkfcq3gucaq25hjqon/sh.tangled.repo.pull/3ml7kaijyha22
+9 -8
Interdiff #3 #4
knotserver/git/git.go

This file has not been changed.

+5 -5
knotserver/internal.go
··· 477 477 user = userIdent.Handle.String() 478 478 } 479 479 480 - pullURL, err := h.createPullURL(h.c.AppViewEndpoint, remote, user, repoName, pushedBranch, defaultBranch) 480 + pullURL, err := h.createPullURL(h.c.AppViewEndpoint, remote, user, ownerDid, repoName, pushedBranch, defaultBranch) 481 481 if err != nil { 482 482 return err 483 483 } ··· 490 490 return nil 491 491 } 492 492 493 - func (h *InternalHandle) createPullURL(appviewURL, remote, user, repoName, pushedBranch, defaultBranch string) (string, error) { 493 + func (h *InternalHandle) createPullURL(appviewURL, remote, user, ownerDID, repoName, pushedBranch, defaultBranch string) (string, error) { 494 494 if remote != "" { 495 - return h.createForkPullURL(appviewURL, remote, user, repoName, pushedBranch, defaultBranch) 495 + return h.createForkPullURL(appviewURL, remote, ownerDID, repoName, pushedBranch, defaultBranch) 496 496 } 497 497 498 498 query := url.Values{} ··· 509 509 return pullURL, nil 510 510 } 511 511 512 - func (h *InternalHandle) createForkPullURL(appviewURL, remote, user, repoName, pushedBranch, defaultBranch string) (string, error) { 512 + func (h *InternalHandle) createForkPullURL(appviewURL, remote, ownerDID, repoName, pushedBranch, defaultBranch string) (string, error) { 513 513 query := url.Values{} 514 514 515 - query.Set("fork", fmt.Sprintf("%s/%s", user, repoName)) 515 + query.Set("fork", fmt.Sprintf("%s/%s", ownerDID, repoName)) 516 516 query.Set("source", "fork") 517 517 query.Set("sourceBranch", pushedBranch) 518 518 query.Set("targetBranch", defaultBranch)
+4 -3
knotserver/internal_test.go
··· 10 10 11 11 const ( 12 12 appviewURL = "https://tangled.org/" 13 - user = "did:plc:dadhhalkfcq3gucaq25hjqon" 13 + user = "willdot.net" 14 + userDID = "did:plc:dadhhalkfcq3gucaq25hjqon" 14 15 pushedBranch = "feature-abc" 15 16 defaultBranch = "main" 16 17 ) ··· 25 26 "not a fork": { 26 27 repoName: "knot-testing", 27 28 remote: "", 28 - expectedURL: "https://tangled.org/did:plc:dadhhalkfcq3gucaq25hjqon/knot-testing/pulls/new?source=branch&sourceBranch=feature-abc&targetBranch=main", 29 + expectedURL: "https://tangled.org/willdot.net/knot-testing/pulls/new?source=branch&sourceBranch=feature-abc&targetBranch=main", 29 30 }, 30 31 "is fork": { 31 32 repoName: "knot-testing-fork", ··· 49 50 h := InternalHandle{ 50 51 db: database, 51 52 } 52 - res, err := h.createPullURL(appviewURL, tc.remote, user, tc.repoName, pushedBranch, defaultBranch) 53 + res, err := h.createPullURL(appviewURL, tc.remote, user, userDID, tc.repoName, pushedBranch, defaultBranch) 53 54 require.NoError(t, err) 54 55 55 56 assert.Equal(t, tc.expectedURL, res)

History

5 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
knotserver: create a fork PR link
merge conflicts detected
expand
  • knotserver/git/git.go:13
  • knotserver/internal.go:8
expand 0 comments
1 commit
expand
knotserver: create a fork PR link
expand 0 comments
1 commit
expand
knotserver: create a fork PR link
expand 0 comments
1 commit
expand
knotserver: create a fork PR link
expand 0 comments
1 commit
expand
knotserver: create a fork PR link
expand 0 comments