Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Last active September 1, 2022 13:20
Show Gist options
  • Save patrickposner/54e3c611ebbaf56893fd62c1fed38704 to your computer and use it in GitHub Desktop.
Save patrickposner/54e3c611ebbaf56893fd62c1fed38704 to your computer and use it in GitHub Desktop.
Simply Static - GitHub Webhook with webhook event
<?php
add_filter( 'ssp_webhook_args', function( $args ) {
// Get access token.
$options = get_option( 'simply-static' );
$access_token = $options['github-personal-access-token'];
// Setup body.
$body = array(
'event_type' => 'repository_dispatch',
);
// Modify arguments for POST request.
$args = array(
'headers' => array(
'Authorization' => 'token ' . $access_token,
'Accept' => 'application/json',
),
'body' => wp_json_encode( $body )
);
return $args;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment