Webhook trigger for actions (CI) #10553

Closed
opened 2025-11-02 09:11:05 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @cthu1hoo on GitHub (Mar 29, 2023).

Feature Description

I'm missing a webhook trigger for CI builds, i.e. action started / action completed / action failed. It would be great if this was a thing.

I'm sorry if this was requested before. Thanks in advance.

Screenshots

No response

Originally created by @cthu1hoo on GitHub (Mar 29, 2023). ### Feature Description I'm missing a webhook trigger for CI builds, i.e. action started / action completed / action failed. It would be great if this was a thing. I'm sorry if this was requested before. Thanks in advance. ### Screenshots _No response_
GiteaMirror added the topic/webhookstopic/gitea-actionstype/proposaltype/feature labels 2025-11-02 09:11:05 -06:00
Author
Owner

@Makonike commented on GitHub (Jun 5, 2023):

Any plans to update?

@Makonike commented on GitHub (Jun 5, 2023): Any plans to update?
Author
Owner

@lunny commented on GitHub (Jun 6, 2023):

Don't know whether Github has implemented this.

@lunny commented on GitHub (Jun 6, 2023): Don't know whether Github has implemented this.
Author
Owner

@xgdgsc commented on GitHub (Jul 23, 2023):

Hope the action started / action completed / action failed webhook trigger can be set on a per-workflow basis.

@xgdgsc commented on GitHub (Jul 23, 2023): Hope the action started / action completed / action failed webhook trigger can be set on a per-workflow basis.
Author
Owner
@lunny commented on GitHub (Sep 27, 2023): ref: https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_run
Author
Owner

@maxstanley commented on GitHub (Nov 12, 2023):

Currently looking at implementing this feature. Hoping for some guidance on what should be returned as the webhook payload for a workflow_run inspired hook.

type HookWorkflowRunAction string

const (
	HookWorkflowRunRequested  HookWorkflowRunAction = "requested"
	HookWorkflowRunInProgress HookWorkflowRunAction = "in_progress"
	HookWorkflowRunCompleted  HookWorkflowRunAction = "completed"
)

type WorkflowRunPayload struct {
	Action     HookWorkflowRunAction `json:"action"`
	Repository *Repository           `json:"repository"`
	Sender     *User                 `json:"sender"`
	ActionRun  *ActionRun            `json:"action_run"`
	Artifacts  *[]Artifact           `json:"artifacts"`
}

type ActionRun struct {
	ID          int64        `json:"id"`
	Title       string       `json:"title"`
	TriggerUser *User        `json:"trigger_user"`
	WorkflowID  string       `json:"workflow_id"`
	Index       int64        `json:"index"`
	Ref         string       `json:"ref"`
	CommitSHA   string       `json:"commit_sha"`
        Branch      string       `json:"branch"`
	Status      string       `json:"status"`
	Version     int          `json:"version"`
	Started     string       `json:"time_started"`
	Stopped     string       `json:"time_stopped"`
	Created     string       `json:"time_created"`
	Updated     string       `json:"time_updated"`
}

type Artifact struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
}

These structs should provide a starting point.

Should this webhook provide fully formed URLs to the hook for:

  • Run URL
  • Workflow URL
  • Artifact URLs

Thanks!

@maxstanley commented on GitHub (Nov 12, 2023): Currently looking at implementing this feature. Hoping for some guidance on what should be returned as the webhook payload for a `workflow_run` inspired hook. ```go type HookWorkflowRunAction string const ( HookWorkflowRunRequested HookWorkflowRunAction = "requested" HookWorkflowRunInProgress HookWorkflowRunAction = "in_progress" HookWorkflowRunCompleted HookWorkflowRunAction = "completed" ) type WorkflowRunPayload struct { Action HookWorkflowRunAction `json:"action"` Repository *Repository `json:"repository"` Sender *User `json:"sender"` ActionRun *ActionRun `json:"action_run"` Artifacts *[]Artifact `json:"artifacts"` } type ActionRun struct { ID int64 `json:"id"` Title string `json:"title"` TriggerUser *User `json:"trigger_user"` WorkflowID string `json:"workflow_id"` Index int64 `json:"index"` Ref string `json:"ref"` CommitSHA string `json:"commit_sha"` Branch string `json:"branch"` Status string `json:"status"` Version int `json:"version"` Started string `json:"time_started"` Stopped string `json:"time_stopped"` Created string `json:"time_created"` Updated string `json:"time_updated"` } type Artifact struct { ID int64 `json:"id"` Name string `json:"name"` } ``` These structs should provide a starting point. Should this webhook provide fully formed URLs to the hook for: - Run URL - Workflow URL - Artifact URLs Thanks!
Author
Owner

@maxstanley commented on GitHub (Nov 12, 2023):

Have just found this #26673 which defines an ActionTask which is very similar to the structure as defined above.

The main omission from ActionTask is the time when the action stopped.

@maxstanley commented on GitHub (Nov 12, 2023): Have just found this #26673 which defines an `ActionTask` which is very similar to the structure as defined above. The main omission from `ActionTask` is the time when the action stopped.
Author
Owner

@meruiden commented on GitHub (Jul 20, 2024):

Why did #28047 get closed ? @lunny ? any chance this still gets implemented? would be awesome.

for now a good workaround is a DIY web call with CURL using the if: always() rule:

  notify:
    runs-on: ubuntu-latest
    if: always()
    steps:
    - name: Notify
      run: echo "Run hooks here"

and then use the apis from #26673 on the receiving end

@meruiden commented on GitHub (Jul 20, 2024): Why did #28047 get closed ? @lunny ? any chance this still gets implemented? would be awesome. for now a good workaround is a DIY web call with CURL using the if: always() rule: ``` yaml notify: runs-on: ubuntu-latest if: always() steps: - name: Notify run: echo "Run hooks here" ``` and then use the apis from #26673 on the receiving end
Author
Owner

@lunny commented on GitHub (Jul 24, 2024):

Why did #28047 get closed ? @lunny ? any chance this still gets implemented? would be awesome.

for now a good workaround is a DIY web call with CURL using the if: always() rule:

  notify:
    runs-on: ubuntu-latest
    if: always()
    steps:
    - name: Notify
      run: echo "Run hooks here"

and then use the apis from #26673 on the receiving end

I have no enough time to continue the work. Please pick up my code if somebody would like to continue.

@lunny commented on GitHub (Jul 24, 2024): > Why did #28047 get closed ? @lunny ? any chance this still gets implemented? would be awesome. > > for now a good workaround is a DIY web call with CURL using the if: always() rule: > > ```yaml > notify: > runs-on: ubuntu-latest > if: always() > steps: > - name: Notify > run: echo "Run hooks here" > ``` > > and then use the apis from #26673 on the receiving end I have no enough time to continue the work. Please pick up my code if somebody would like to continue.
Author
Owner

@SpiritTheWalf commented on GitHub (Jan 9, 2025):

Any updates to this? It's exactly what I'm looking for but I don't have the knowledge to implement it myself

@SpiritTheWalf commented on GitHub (Jan 9, 2025): Any updates to this? It's exactly what I'm looking for but I don't have the knowledge to implement it myself
Author
Owner

@JohnDowson commented on GitHub (Jan 24, 2025):

Support for this is pretty much crucial for commercial use.

@JohnDowson commented on GitHub (Jan 24, 2025): Support for this is pretty much crucial for commercial use.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10553