From 421a77096706af09760511dd65e265e418f5e65f Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 11 May 2021 22:20:04 +0200 Subject: [PATCH] Fix activity plugin when 0 commits are pushed --- source/plugins/activity/index.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/plugins/activity/index.mjs b/source/plugins/activity/index.mjs index 0a66c2c6..9160d4b7 100644 --- a/source/plugins/activity/index.mjs +++ b/source/plugins/activity/index.mjs @@ -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.(?.*)/)?.groups?.branch ?? null, commits:commits.reverse().map(({sha, message}) => ({sha:sha.substring(0, 7), message}))} } //Released