mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 09:52:26 +02:00
Trigger sync webhooks on UI commit (#2302)
* Trigger sync webhooks on UI commit * Also fix UI upload/delete
This commit is contained in:
parent
951fb572a7
commit
7907786040
3 changed files with 79 additions and 60 deletions
|
@ -64,7 +64,24 @@ type PushUpdateOptions struct {
|
|||
|
||||
// PushUpdate must be called for any push actions in order to
|
||||
// generates necessary push action history feeds.
|
||||
func PushUpdate(opts PushUpdateOptions) (repo *Repository, err error) {
|
||||
func PushUpdate(branch string, opt PushUpdateOptions) error {
|
||||
repo, err := pushUpdate(opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pusher, err := GetUserByID(opt.PusherID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)
|
||||
|
||||
go AddTestPullRequestTask(pusher, repo.ID, branch, true)
|
||||
return nil
|
||||
}
|
||||
|
||||
func pushUpdate(opts PushUpdateOptions) (repo *Repository, err error) {
|
||||
isNewRef := opts.OldCommitID == git.EmptySHA
|
||||
isDelRef := opts.NewCommitID == git.EmptySHA
|
||||
if isNewRef && isDelRef {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue