Add plugin_activity_load option
This commit is contained in:
@@ -15,11 +15,11 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {limit, days, filter, visibility, timestamps, skipped} = imports.metadata.plugins.activity.inputs({data, q, account})
|
let {limit, load, days, filter, visibility, timestamps, skipped} = imports.metadata.plugins.activity.inputs({data, q, account})
|
||||||
if (!days)
|
if (!days)
|
||||||
days = Infinity
|
days = Infinity
|
||||||
skipped.push(...data.shared["repositories.skipped"])
|
skipped.push(...data.shared["repositories.skipped"])
|
||||||
const pages = Math.ceil(limit / 100)
|
const pages = Math.ceil(load / 100)
|
||||||
const codelines = 2
|
const codelines = 2
|
||||||
|
|
||||||
//Get user recent activity
|
//Get user recent activity
|
||||||
@@ -27,8 +27,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
const events = []
|
const events = []
|
||||||
try {
|
try {
|
||||||
for (let page = 1; page <= pages; page++) {
|
for (let page = 1; page <= pages; page++) {
|
||||||
console.debug(`metrics/compute/${login}/plugins > activity > loading page ${page}`)
|
console.debug(`metrics/compute/${login}/plugins > activity > loading page ${page}/${pages}`)
|
||||||
events.push(...(context.mode === "repository" ? await rest.activity.listRepoEvents({owner:context.owner, repo:context.repo}) : await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100})).data)
|
events.push(...(context.mode === "repository" ? await rest.activity.listRepoEvents({owner:context.owner, repo:context.repo}) : await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100, page})).data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
@@ -67,7 +67,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
}
|
}
|
||||||
//Forked repository
|
//Forked repository
|
||||||
case "ForkEvent": {
|
case "ForkEvent": {
|
||||||
return {type:"fork", actor, timestamp, repo}
|
const {forkee:{full_name:forked}} = payload
|
||||||
|
return {type:"fork", actor, timestamp, repo, forked}
|
||||||
}
|
}
|
||||||
//Wiki editions
|
//Wiki editions
|
||||||
case "GollumEvent": {
|
case "GollumEvent": {
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ inputs:
|
|||||||
min: 1
|
min: 1
|
||||||
max: 1000
|
max: 1000
|
||||||
|
|
||||||
|
# Number of activity events to load
|
||||||
|
# This should be higher than "plugin_activity_limit"
|
||||||
|
# A high number will consume more requests
|
||||||
|
plugin_activity_load:
|
||||||
|
description: Number of events to load
|
||||||
|
type: number
|
||||||
|
default: 300
|
||||||
|
min: 100
|
||||||
|
max: 1000
|
||||||
|
|
||||||
# Filter events by age
|
# Filter events by age
|
||||||
# Note that it only filter fetched events, you may need to increase "plugin_activity_limit" to display older events
|
# Note that it only filter fetched events, you may need to increase "plugin_activity_limit" to display older events
|
||||||
# Set to 0 to disable age filtering
|
# Set to 0 to disable age filtering
|
||||||
|
|||||||
Reference in New Issue
Block a user