diff --git a/internal/runbits/buildscript/file.go b/internal/runbits/buildscript/file.go index e5cecf8f1f..b950abcbbc 100644 --- a/internal/runbits/buildscript/file.go +++ b/internal/runbits/buildscript/file.go @@ -37,7 +37,18 @@ func ScriptFromFile(path string) (*buildscript.BuildScript, error) { } return nil, errs.Wrap(err, "Could not read build script from file") } - return buildscript.Unmarshal(data) + + script, err := buildscript.Unmarshal(data) + if err != nil { + return nil, errs.Wrap(err, "Could not unmarshal build script") + } + + err = checkoutinfo.UpdateProject(script, path) + if err != nil { + return nil, errs.Wrap(err, "Could not update project file") + } + + return script, nil } func Initialize(path, owner, project, branch string, auth *authentication.Auth) error { diff --git a/pkg/checkoutinfo/checkoutinfo.go b/pkg/checkoutinfo/checkoutinfo.go index 2788fff471..62b3bef482 100644 --- a/pkg/checkoutinfo/checkoutinfo.go +++ b/pkg/checkoutinfo/checkoutinfo.go @@ -112,3 +112,18 @@ func updateBuildScript() error { return nil } + +func UpdateProject(script *buildscript.BuildScript, dir string) error { + err := setupProject(dir) + if err != nil { + return errs.Wrap(err, "Could not setup project") + } + + proj.Source().Project = script.ProjectURL() + err = proj.Source().Save(nil) + if err != nil { + return errs.Wrap(err, "Could not update project") + } + + return nil +}