Last active
September 1, 2022 13:20
-
-
Save patrickposner/54e3c611ebbaf56893fd62c1fed38704 to your computer and use it in GitHub Desktop.
Simply Static - GitHub Webhook with webhook event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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