Skip to content

Commit

Permalink
Fix dim-bots with multiple PR labels (#4355)
Browse files Browse the repository at this point in the history
  • Loading branch information
agaudreault committed May 16, 2021
1 parent 6ec34e5 commit 73fa11a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions source/features/dim-bots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@ import * as pageDetect from 'github-url-detection';

import features from '.';

const botSelector = [
const commitSelector = [
/* Commits */
'.commit-author[href$="%5Bbot%5D"]',
'.commit-author[href$="renovate-bot"]',
'.commit-author[href$="scala-steward"]',
'.commit-author[href$="scala-steward"]'
].join();

const prSelector = [
/* Issues/PRs */
'.opened-by [href*="author%3Aapp%2F"]',
'.labels [href$="label%3Abot"]'
].join();
];

function init(): void {
for (const bot of select.all(botSelector)) {
for (const bot of select.all(commitSelector)) {
// Exclude co-authored commits
if (select.all('a', bot.parentElement!).every(link => link.matches(botSelector))) {
if (select.all('a', bot.parentElement!).every(link => link.matches(commitSelector))) {
bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
}
}

for (const bot of select.all(prSelector)) {
bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
}
}

void features.add(__filebasename, {
Expand Down

0 comments on commit 73fa11a

Please sign in to comment.