mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Fix package webhook (#27839)
Fix #23742 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
		| @@ -293,6 +293,24 @@ func getIssueCommentPayloadInfo(p *api.IssueCommentPayload, linkFormatter linkFo | ||||
| 	return text, issueTitle, color | ||||
| } | ||||
|  | ||||
| func getPackagePayloadInfo(p *api.PackagePayload, linkFormatter linkFormatter, withSender bool) (text string, color int) { | ||||
| 	refLink := linkFormatter(p.Package.HTMLURL, p.Package.Name+":"+p.Package.Version) | ||||
|  | ||||
| 	switch p.Action { | ||||
| 	case api.HookPackageCreated: | ||||
| 		text = fmt.Sprintf("Package created: %s", refLink) | ||||
| 		color = greenColor | ||||
| 	case api.HookPackageDeleted: | ||||
| 		text = fmt.Sprintf("Package deleted: %s", refLink) | ||||
| 		color = redColor | ||||
| 	} | ||||
| 	if withSender { | ||||
| 		text += fmt.Sprintf(" by %s", linkFormatter(setting.AppURL+url.PathEscape(p.Sender.UserName), p.Sender.UserName)) | ||||
| 	} | ||||
|  | ||||
| 	return text, color | ||||
| } | ||||
|  | ||||
| // ToHook convert models.Webhook to api.Hook | ||||
| // This function is not part of the convert package to prevent an import cycle | ||||
| func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user