Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook trigger for actions (CI) #23796

Open
cthu1hoo opened this issue Mar 29, 2023 · 6 comments
Open

Webhook trigger for actions (CI) #23796

cthu1hoo opened this issue Mar 29, 2023 · 6 comments
Labels
topic/gitea-actions related to the actions of Gitea topic/webhooks type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@cthu1hoo
Copy link

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

@cthu1hoo cthu1hoo added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Mar 29, 2023
@wolfogre wolfogre added topic/webhooks topic/gitea-actions related to the actions of Gitea labels Mar 30, 2023
@Makonike
Copy link
Contributor

Makonike commented Jun 5, 2023

Any plans to update?

@lunny
Copy link
Member

lunny commented Jun 6, 2023

Don't know whether Github has implemented this.

@xgdgsc
Copy link

xgdgsc commented Jul 23, 2023

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

@lunny
Copy link
Member

lunny commented Sep 27, 2023

ref: https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_run

@maxstanley
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gitea-actions related to the actions of Gitea topic/webhooks type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

6 participants