(ctx context.Context, assetID, remote, branch, token string, author *object.Signature)
| 1208 | } |
| 1209 | |
| 1210 | func (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 | |
| 1242 | func (s *Server) githubAppInstallationURL(state githubConnectState) (string, error) { |
| 1243 | res := fmt.Sprintf("https://github.com/apps/%s/installations/new", s.opts.GithubAppName) |
no test coverage detected