Skip to content

Commit

Permalink
add analytics to track 'uses' for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Jul 1, 2019
1 parent 386b007 commit 4cec160
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const ms = require('ms')
const { Context } = require('probot')
const analytics = require('./analytics')

const { CLOSE, MERGE, LABEL } = require('./constants')

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4cec160

Please sign in to comment.