mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-24 23:51:04 +01:00
...
This commit is contained in:
parent
de0d8da7b6
commit
4a9a54e2df
@ -356,6 +356,12 @@ func ReqChangeRepoFileOptionsAndCheck(ctx *context.APIContext) {
|
||||
OldBranch: commonOpts.BranchName,
|
||||
NewBranch: commonOpts.NewBranchName,
|
||||
ForcePush: commonOpts.ForcePush,
|
||||
ActionsTaskID: func() int64 {
|
||||
if ctx.Data["ActionsTaskID"] != nil {
|
||||
return ctx.Data["ActionsTaskID"].(int64)
|
||||
}
|
||||
return 0
|
||||
}(),
|
||||
Committer: &files_service.IdentityOptions{
|
||||
GitUserName: commonOpts.Committer.Name,
|
||||
GitUserEmail: commonOpts.Committer.Email,
|
||||
|
||||
@ -33,6 +33,8 @@ type TemporaryUploadRepository struct {
|
||||
gitRepo *git.Repository
|
||||
basePath string
|
||||
cleanup func()
|
||||
|
||||
ActionsTaskID int64
|
||||
}
|
||||
|
||||
// NewTemporaryUploadRepository creates a new temporary upload repository
|
||||
@ -362,6 +364,9 @@ func (t *TemporaryUploadRepository) CommitTree(ctx context.Context, opts *Commit
|
||||
func (t *TemporaryUploadRepository) Push(ctx context.Context, doer *user_model.User, commitHash, branch string, force bool) error {
|
||||
// Because calls hooks we need to pass in the environment
|
||||
env := repo_module.PushingEnvironment(doer, t.repo)
|
||||
if t.ActionsTaskID > 0 {
|
||||
env = append(env, repo_module.EnvActionsTaskID+"="+fmt.Sprintf("%d", t.ActionsTaskID))
|
||||
}
|
||||
if err := gitrepo.PushFromLocal(ctx, t.basePath, t.repo, git.PushOptions{
|
||||
Branch: strings.TrimSpace(commitHash) + ":" + git.BranchPrefix + strings.TrimSpace(branch),
|
||||
Env: env,
|
||||
|
||||
@ -64,6 +64,7 @@ type ChangeRepoFilesOptions struct {
|
||||
Dates *CommitDateOptions
|
||||
Signoff bool
|
||||
ForcePush bool
|
||||
ActionsTaskID int64
|
||||
}
|
||||
|
||||
type RepoFileOptions struct {
|
||||
@ -177,6 +178,7 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
||||
if err != nil {
|
||||
log.Error("NewTemporaryUploadRepository failed: %v", err)
|
||||
}
|
||||
t.ActionsTaskID = opts.ActionsTaskID
|
||||
defer t.Close()
|
||||
hasOldBranch := true
|
||||
if err := t.Clone(ctx, opts.OldBranch, true); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user