From 4cec16004b1d786bf20ab9f680dcc70c106dbe7e Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Mon, 1 Jul 2019 14:10:48 -0400 Subject: [PATCH] add analytics to track 'uses' for deprecation --- src/config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/config.js b/src/config.js index b91140d..73f2285 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,6 @@ const ms = require('ms') const { Context } = require('probot') +const analytics = require('./analytics') const { CLOSE, MERGE, LABEL } = require('./constants') @@ -44,10 +45,19 @@ function createEvent(context, owner, repo) { module.exports = async context => { let config = await context.config(CONFIG_FILE, defaultConfig) + // TODO deprecated, remove if (typeof config.uses === 'string' && config.uses.indexOf('/') > -1) { const [owner, repo] = config.uses.split('/') const globalContext = new Context(createEvent(context, owner, repo), context.github) config = await globalContext.config(CONFIG_FILE, defaultConfig) + try { + analytics.track({ + userId: context.payload.installation.id, + event: `Config using 'uses'` + }) + } catch (e) { + // pass + } } if (typeof config.extends === 'string' && config.extends.indexOf('/') > -1) {