From 6e33ffb32fb5711ebd13e179f62e1b4209549d3e Mon Sep 17 00:00:00 2001 From: Enrique Piqueras Date: Wed, 5 Feb 2020 01:31:22 -0500 Subject: [PATCH] Project Management Automation: Log skipped tasks and retain wrapped task names. (#20034) * Project Management Automation: Log skipped tasks and retain wrapped task names. * Project Management Automation: Set function name properly. --- .../project-management-automation/lib/if-not-fork.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/project-management-automation/lib/if-not-fork.js b/packages/project-management-automation/lib/if-not-fork.js index a4fc4ba611b4b..b64228c9fde4f 100644 --- a/packages/project-management-automation/lib/if-not-fork.js +++ b/packages/project-management-automation/lib/if-not-fork.js @@ -1,3 +1,8 @@ +/** + * Internal dependencies + */ +const debug = require( './debug' ); + /** * Higher-order function which executes and returns the result of the given * handler only if the enhanced function is called with a payload indicating a @@ -8,14 +13,17 @@ * @return {Function} Enhanced task. */ function ifNotFork( handler ) { - return ( payload, ...args ) => { + const newHandler = ( payload, ...args ) => { if ( payload.pull_request.head.repo.full_name === payload.pull_request.base.repo.full_name ) { return handler( payload, ...args ); } + debug( `main: Skipping ${ handler.name } because we are in a fork.` ); }; + Object.defineProperty( newHandler, 'name', { value: handler.name } ); + return newHandler; } module.exports = ifNotFork;