Skip to content

Commit

Permalink
Fix activity plugin when 0 commits are pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed May 11, 2021
1 parent 70615e7 commit 421a770
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/plugins/activity/index.mjs
Expand Up @@ -121,8 +121,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
//Pushed commits
case "PushEvent": {
let {size, commits, ref} = payload
if (commits[commits.length - 1].message.startsWith("Merge branch "))
commits = [commits[commits.length - 1]]
if (commits.slice(-1).pop()?.message.startsWith("Merge branch "))
commits = commits.slice(-1)
return {type:"push", actor, timestamp, repo, size, branch:ref.match(/refs.heads.(?<branch>.*)/)?.groups?.branch ?? null, commits:commits.reverse().map(({sha, message}) => ({sha:sha.substring(0, 7), message}))}
}
//Released
Expand Down

0 comments on commit 421a770

Please sign in to comment.