feat(plugins/activity): add plugin_activity_ignored option (#705) [skip ci]
This commit is contained in:
@@ -15,7 +15,7 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
}
|
||||
|
||||
//Load inputs
|
||||
let {limit, load, days, filter, visibility, timestamps, skipped} = imports.metadata.plugins.activity.inputs({data, q, account})
|
||||
let {limit, load, days, filter, visibility, timestamps, skipped, ignored} = imports.metadata.plugins.activity.inputs({data, q, account})
|
||||
if (!days)
|
||||
days = Infinity
|
||||
skipped.push(...data.shared["repositories.skipped"])
|
||||
@@ -53,6 +53,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["created"].includes(payload.action))
|
||||
return null
|
||||
const {comment:{user:{login:user}, commit_id:sha, body:content}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"comment", on:"commit", actor, timestamp, repo, content:await imports.markdown(content, {mode:markdown, codelines}), user, mobile:null, number:sha.substring(0, 7), title:""}
|
||||
}
|
||||
//Created a git branch or tag
|
||||
@@ -80,6 +82,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["created"].includes(payload.action))
|
||||
return null
|
||||
const {issue:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"comment", on:"issue", actor, timestamp, repo, content:await imports.markdown(content, {mode:markdown, codelines}), user, mobile, number, title}
|
||||
}
|
||||
//Issue event
|
||||
@@ -87,6 +91,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["opened", "closed", "reopened"].includes(payload.action))
|
||||
return null
|
||||
const {action, issue:{user:{login:user}, title, number, body:content}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"issue", actor, timestamp, repo, action, user, number, title, content:await imports.markdown(content, {mode:markdown, codelines})}
|
||||
}
|
||||
//Activity from repository collaborators
|
||||
@@ -94,6 +100,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["added"].includes(payload.action))
|
||||
return null
|
||||
const {member:{login:user}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"member", actor, timestamp, repo, user}
|
||||
}
|
||||
//Made repository public
|
||||
@@ -105,11 +113,15 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["opened", "closed"].includes(payload.action))
|
||||
return null
|
||||
const {action, pull_request:{user:{login:user}, title, number, body:content, additions:added, deletions:deleted, changed_files:changed, merged}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"pr", actor, timestamp, repo, action:(action === "closed") && (merged) ? "merged" : action, user, title, number, content:await imports.markdown(content, {mode:markdown, codelines}), lines:{added, deleted}, files:{changed}}
|
||||
}
|
||||
//Reviewed a pull request
|
||||
case "PullRequestReviewEvent": {
|
||||
const {review:{state:review}, pull_request:{user:{login:user}, number, title}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"review", actor, timestamp, repo, review, user, number, title}
|
||||
}
|
||||
//Commented on a pull request
|
||||
@@ -117,6 +129,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
||||
if (!["created"].includes(payload.action))
|
||||
return null
|
||||
const {pull_request:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
|
||||
if (ignored.includes(user))
|
||||
return null
|
||||
return {type:"comment", on:"pr", actor, timestamp, repo, content:await imports.markdown(content, {mode:markdown, codelines}), user, mobile, number, title}
|
||||
}
|
||||
//Pushed commits
|
||||
|
||||
@@ -85,4 +85,9 @@ inputs:
|
||||
type: array
|
||||
format: comma-separated
|
||||
default: ""
|
||||
example: my-repo-1, my-repo-2, owner/repo-3, ...
|
||||
example: my-repo-1, my-repo-2, owner/repo-3, ...
|
||||
|
||||
# Ignored actors (useful to ignore bots users)
|
||||
plugin_activity_ignored:
|
||||
description: Actors to ignore
|
||||
default: github-actions[bot], dependabot[bot], dependabot-preview[bot]
|
||||
Reference in New Issue
Block a user