diff --git a/src/models/webhook_events.rs b/src/models/webhook_events.rs index 5720f858..daf3c928 100644 --- a/src/models/webhook_events.rs +++ b/src/models/webhook_events.rs @@ -609,6 +609,12 @@ pub enum WebhookEventType { /// **Note:** This event is deprecated. see the /// [`DependabotAlert`](WebhookEventType::DependabotAlert) event instead. RepositoryVulnerabilityAlert, + /// The schedule event allows you to trigger a workflow at a scheduled time. + /// + /// You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled + /// workflows run on the latest commit on the default or base branch. The shortest interval you + /// can run scheduled workflows is once every 5 minutes. + Schedule, /// This event occurs when there is activity relating to a secret scanning alert. For more /// information about secret scanning, see "About secret scanning." /// @@ -898,6 +904,9 @@ impl WebhookEventType { serde_json::from_value(data)?, ))) } + WebhookEventType::Schedule => Ok(WebhookEventPayload::Schedule(Box::new( + serde_json::from_value(data)?, + ))), WebhookEventType::SecretScanningAlert => Ok(WebhookEventPayload::SecretScanningAlert( Box::new(serde_json::from_value(data)?), )), diff --git a/src/models/webhook_events/payload.rs b/src/models/webhook_events/payload.rs index fa149aef..4fe50834 100644 --- a/src/models/webhook_events/payload.rs +++ b/src/models/webhook_events/payload.rs @@ -51,6 +51,7 @@ mod repository_advisory; mod repository_dispatch; mod repository_import; mod repository_vulnerability_alert; +mod schedule; mod secret_scanning_alert; mod secret_scanning_alert_location; mod security_advisory; @@ -77,9 +78,10 @@ pub use self::{ pull_request::*, pull_request_review::*, pull_request_review_comment::*, pull_request_review_thread::*, push::*, registry_package::*, release::*, repository::*, repository_advisory::*, repository_dispatch::*, repository_import::*, - repository_vulnerability_alert::*, secret_scanning_alert::*, secret_scanning_alert_location::*, - security_advisory::*, security_and_analysis::*, sponsorship::*, star::*, status::*, team::*, - team_add::*, watch::*, workflow_dispatch::*, workflow_job::*, workflow_run::*, + repository_vulnerability_alert::*, schedule::*, secret_scanning_alert::*, + secret_scanning_alert_location::*, security_advisory::*, security_and_analysis::*, + sponsorship::*, star::*, status::*, team::*, team_add::*, watch::*, workflow_dispatch::*, + workflow_job::*, workflow_run::*, }; use serde::{Deserialize, Serialize}; @@ -141,6 +143,7 @@ pub enum WebhookEventPayload { RepositoryDispatch(Box), RepositoryImport(Box), RepositoryVulnerabilityAlert(Box), + Schedule(Box), SecretScanningAlert(Box), SecretScanningAlertLocation(Box), SecurityAdvisory(Box), diff --git a/src/models/webhook_events/payload/schedule.rs b/src/models/webhook_events/payload/schedule.rs new file mode 100644 index 00000000..e22bf5e1 --- /dev/null +++ b/src/models/webhook_events/payload/schedule.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ScheduleWebhookEventPayload { + pub schedule: String, + pub workflow: String, +}