summaryrefslogtreecommitdiff
path: root/source/github-events/on-pr-merge.ts
blob: 16b49f2b4f4db818c51b3f7f8430428260466b16 (plain) (blame)
1
2
3
4
5
6
7
8
9
import {oneEvent} from 'delegate-it';

import observe from '../helpers/selector-observer.js';

// This event ensures that the callback appears exclusively to the person that merged the PR and not anyone who was on the page at the time of the merge
export default async function onPrMerge(callback: VoidFunction, signal: AbortSignal): Promise<void> {
	await oneEvent('.js-merge-commit-button', 'click', {signal});
	observe('.TimelineItem-badge .octicon-git-merge', callback, {signal});
}