MCPcopy Index your code
hub / github.com/rilldata/rill / pushAssetToGit

Method pushAssetToGit

admin/server/github.go:1210–1240  ·  view source on GitHub ↗
(ctx context.Context, assetID, remote, branch, token string, author *object.Signature)

Source from the content-addressed store, hash-verified

1208}
1209
1210func (s *Server) pushAssetToGit(ctx context.Context, assetID, remote, branch, token string, author *object.Signature) error {
1211 asset, err := s.admin.DB.FindAsset(ctx, assetID)
1212 if err != nil {
1213 return err
1214 }
1215
1216 downloadURL, err := s.generateSignedDownloadURL(asset)
1217 if err != nil {
1218 return err
1219 }
1220 downloadDir, err := os.MkdirTemp(os.TempDir(), "extracted_archives")
1221 if err != nil {
1222 return err
1223 }
1224 defer os.RemoveAll(downloadDir)
1225 downloadDst := filepath.Join(downloadDir, "zipped_repo.tar.gz")
1226
1227 projPath := filepath.Join(downloadDir, "projects")
1228 err = archive.Download(ctx, downloadURL, downloadDst, projPath, false, true)
1229 if err != nil {
1230 return err
1231 }
1232
1233 config := &cligitutil.Config{
1234 Remote: remote,
1235 Username: "x-access-token",
1236 Password: token,
1237 DefaultBranch: branch,
1238 }
1239 return cligitutil.CommitAndPush(ctx, projPath, config, "", author)
1240}
1241
1242func (s *Server) githubAppInstallationURL(state githubConnectState) (string, error) {
1243 res := fmt.Sprintf("https://github.com/apps/%s/installations/new", s.opts.GithubAppName)

Callers 1

Calls 5

DownloadFunction · 0.92
FindAssetMethod · 0.65
TempDirMethod · 0.65
CommitAndPushMethod · 0.65

Tested by

no test coverage detected