fix empty ref for cron workflow runs (#28640) (#28647)

Backport #28640 by @denyskon

Fix #27678 
Please see
https://github.com/go-gitea/gitea/issues/27678#issuecomment-1871445853
for details.

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
pull/28658/head
Giteabot 11 months ago committed by GitHub
parent ff565a787f
commit 683b95f0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      services/actions/notifier_helper.go

@ -188,7 +188,7 @@ func notify(ctx context.Context, input *notifyInput) error {
} }
} }
if err := handleSchedules(ctx, schedules, commit, input); err != nil { if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil {
return err return err
} }
@ -373,6 +373,7 @@ func handleSchedules(
detectedWorkflows []*actions_module.DetectedWorkflow, detectedWorkflows []*actions_module.DetectedWorkflow,
commit *git.Commit, commit *git.Commit,
input *notifyInput, input *notifyInput,
ref string,
) error { ) error {
branch, err := commit.GetBranchName() branch, err := commit.GetBranchName()
if err != nil { if err != nil {
@ -422,7 +423,7 @@ func handleSchedules(
OwnerID: input.Repo.OwnerID, OwnerID: input.Repo.OwnerID,
WorkflowID: dwf.EntryName, WorkflowID: dwf.EntryName,
TriggerUserID: input.Doer.ID, TriggerUserID: input.Doer.ID,
Ref: input.Ref, Ref: ref,
CommitSHA: commit.ID.String(), CommitSHA: commit.ID.String(),
Event: input.Event, Event: input.Event,
EventPayload: string(p), EventPayload: string(p),

Loading…
Cancel
Save