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
|
//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)
|
if (!days)
|
||||||
days = Infinity
|
days = Infinity
|
||||||
skipped.push(...data.shared["repositories.skipped"])
|
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))
|
if (!["created"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {comment:{user:{login:user}, commit_id:sha, body:content}} = payload
|
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:""}
|
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
|
//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))
|
if (!["created"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {issue:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
|
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}
|
return {type:"comment", on:"issue", actor, timestamp, repo, content:await imports.markdown(content, {mode:markdown, codelines}), user, mobile, number, title}
|
||||||
}
|
}
|
||||||
//Issue event
|
//Issue event
|
||||||
@@ -87,6 +91,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
if (!["opened", "closed", "reopened"].includes(payload.action))
|
if (!["opened", "closed", "reopened"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {action, issue:{user:{login:user}, title, number, body:content}} = payload
|
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})}
|
return {type:"issue", actor, timestamp, repo, action, user, number, title, content:await imports.markdown(content, {mode:markdown, codelines})}
|
||||||
}
|
}
|
||||||
//Activity from repository collaborators
|
//Activity from repository collaborators
|
||||||
@@ -94,6 +100,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
if (!["added"].includes(payload.action))
|
if (!["added"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {member:{login:user}} = payload
|
const {member:{login:user}} = payload
|
||||||
|
if (ignored.includes(user))
|
||||||
|
return null
|
||||||
return {type:"member", actor, timestamp, repo, user}
|
return {type:"member", actor, timestamp, repo, user}
|
||||||
}
|
}
|
||||||
//Made repository public
|
//Made repository public
|
||||||
@@ -105,11 +113,15 @@ export default async function({login, data, rest, q, account, imports}, {enabled
|
|||||||
if (!["opened", "closed"].includes(payload.action))
|
if (!["opened", "closed"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {action, pull_request:{user:{login:user}, title, number, body:content, additions:added, deletions:deleted, changed_files:changed, merged}} = payload
|
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}}
|
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
|
//Reviewed a pull request
|
||||||
case "PullRequestReviewEvent": {
|
case "PullRequestReviewEvent": {
|
||||||
const {review:{state:review}, pull_request:{user:{login:user}, number, title}} = payload
|
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}
|
return {type:"review", actor, timestamp, repo, review, user, number, title}
|
||||||
}
|
}
|
||||||
//Commented on a pull request
|
//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))
|
if (!["created"].includes(payload.action))
|
||||||
return null
|
return null
|
||||||
const {pull_request:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
|
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}
|
return {type:"comment", on:"pr", actor, timestamp, repo, content:await imports.markdown(content, {mode:markdown, codelines}), user, mobile, number, title}
|
||||||
}
|
}
|
||||||
//Pushed commits
|
//Pushed commits
|
||||||
|
|||||||
@@ -86,3 +86,8 @@ inputs:
|
|||||||
format: comma-separated
|
format: comma-separated
|
||||||
default: ""
|
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