Skip to content

Commit

Permalink
reimplement isMergeCommit for diff skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed May 7, 2024
1 parent c92ce49 commit c3224ab
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/services/webapp/api/webhook-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ const SERVER_EMOJI_MAP = {
"2": "2️⃣",
"3": "3️⃣",
};

const isRemoteMergeCommit = (message: string) =>
message.startsWith("Merge remote-tracking") || message.startsWith("Merge pull request");
const isMergeCommit = (message: string) =>
message.startsWith("Merge branch") || isRemoteMergeCommit(message);

export default (webApp: WebApp): void => {
webApp.app.use(createNodeMiddleware(GitHub, { path: "/webhooks/github" }));
Expand Down Expand Up @@ -318,9 +319,7 @@ export default (webApp: WebApp): void => {
}
}

let diff = isRemoteMergeCommit(commit.message)
? undefined
: await getGitHubDiff(commit.url);
let diff = isMergeCommit(commit.message) ? undefined : await getGitHubDiff(commit.url);
if (diff) {
diff = diff.replaceAll(/(@@ -\d+,\d+ .+\d+,\d+ @@)[^\n]/g, "$1\n");
diff = diff.replaceAll(/diff.+\nindex.+\n/g, "");
Expand Down

0 comments on commit c3224ab

Please sign in to comment.