Filter uncanny-automator-pro

automator_github_pro_pull_request_events

Filter GitHub identify pull request events. Filters GitHub pull request events before they are identified by the integration.

add_filter( 'automator_github_pro_pull_request_events', $callback, 10, 1 );

Description

Filter the array of GitHub pull request event types Uncanny Automator listens for. This filter fires when checking for pull request events. Developers can add or remove event types from the `$pr_events` array to customize which pull request actions trigger Automator recipes.


Usage

add_filter( 'automator_github_pro_pull_request_events', 'your_function_name', 10, 1 );

Parameters

$pr_events (array)

Return Value

array


Examples

/**
 * Example of adding a custom GitHub pull request event to the automator filter.
 * This example adds a hypothetical 'custom_pr_event' to the list of tracked events.
 */
add_filter( 'automator_github_pro_pull_request_events', function( $pr_events ) {
	// Add a new custom event type to the array if it's not already present.
	if ( ! in_array( 'custom_pr_event', $pr_events, true ) ) {
		$pr_events[] = 'custom_pr_event';
	}
	return $pr_events;
}, 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/integrations/github/triggers/event-occurs-in-repo.php:346

private static function is_pull_request_event( $event ) {

		$pr_events = array( 'pull_request', 'pull_request_review' );

		/**
		 * Filter GitHub identify pull request events.
		 *
		 * @link https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
		 *
		 * @param array $pr_events
		 *
		 * @return array
		 *
		 * @example:
		 * add_filter( 'automator_github_pro_pull_request_events', function( $pr_events ) {
		 *     if ( 'workflow_run' === $event ) {
		 *         $pr_events[] = 'pull_request_review';
		 *         );
		 *     }
		 *     return $pr_events;
		 * }, 10, 1 );
		 * } );

Internal Usage

Found in uncanny-automator-pro/src/integrations/github/triggers/event-occurs-in-repo.php:337:

* add_filter( 'automator_github_pro_pull_request_events', function( $pr_events ) {
Scroll to Top