Skip to content

Commit 376faef

Browse files
Handle the push event payload no longer shipping commits on it
1 parent e3c7f7e commit 376faef

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

commit.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import name from './name.js';
22

3-
export default function commit(repo, payload, index = 0) {
4-
if (!payload.commits) {
5-
console.log({ repo, payload });
6-
}
7-
8-
const commit = [...payload.commits].reverse()[index];
9-
10-
return `\n [${commit.message.match(/^.*/g)[0]}](https://github.com/${repo.name}/commit/${commit.sha})\n into${name(repo.name)}`;
3+
export default function commit(repo, payload) {
4+
// TODO: Find out a new way to get the commit name
5+
return `\n [commit](https://github.com/${repo.name}/commit/${payload.head})\n into${name(repo.name)}`;
116
}

writePushEvent.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
import commit from './commit.js';
2-
import time from './time.js';
32

43
// https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pushevent
54
export default function writePushEvent(event) {
6-
console.log({ event });
7-
85
let markdown = `📌 pushed${commit(event.repo, event.payload)}`;
9-
for (let index = 1; index < event.payload.commits.length; index++) {
10-
markdown += `\n- \`${time(new Date(event.created_at))}\`\n `;
11-
markdown += `📌 pushed${commit(event.repo, event.payload, index)}`;
12-
}
136

147
return markdown;
158
}

0 commit comments

Comments
 (0)