[VAULT-39333] pipeline(copy-pr): always fetch HEAD repo with it's clone URL (#9047) (#9061)

* always fetch HEAD repo with it's clone URL
* use the number instead of ID when generating the summary table

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
This commit is contained in:
Vault Automation 2025-09-02 17:21:43 -06:00 committed by GitHub
parent db994695e0
commit 27fa51c7a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,7 +155,7 @@ func (r *CopyPullRequestReq) Run(
Track: []string{prBranch},
Fetch: true,
Name: r.FromOrigin,
URL: fmt.Sprintf("https://github.com/%s/%s.git", r.FromOwner, r.FromRepo),
URL: res.OriginPullRequest.GetHead().GetRepo().GetCloneURL(),
})
if err != nil {
err = fmt.Errorf("fetching target branch base ref: %s, %w", remoteRes.String(), err)
@ -400,11 +400,11 @@ func (r *CopyPullRequestRes) ToTable(err error) table.Writer {
if r.Request != nil {
from := r.Request.FromOwner + "/" + r.Request.FromRepo
if pr := r.OriginPullRequest; pr != nil {
from = fmt.Sprintf("[%s#%d](%s)", from, pr.GetID(), pr.GetHTMLURL())
from = fmt.Sprintf("[%s#%d](%s)", from, pr.GetNumber(), pr.GetHTMLURL())
}
to := r.Request.ToOwner + "/" + r.Request.ToRepo
if pr := r.PullRequest; pr != nil {
to = fmt.Sprintf("[%s#%d](%s)", to, pr.GetID(), pr.GetHTMLURL())
to = fmt.Sprintf("[%s#%d](%s)", to, pr.GetNumber(), pr.GetHTMLURL())
}
row = table.Row{from, to}
}