Skip to content

Commit

Permalink
fix(manage-merge-queue): remove PRs from queue properly (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian authored Jul 10, 2024
1 parent 3e55d2b commit 3483bf7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions dist/676.index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/676.index.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/helpers/manage-merge-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
import { HelperInputs } from '../types/generated';
import { PullRequest, PullRequestList } from '../types/github';
import { context } from '@actions/github';
import { map } from 'bluebird';
import { notifyUser } from '../utils/notify-user';
import { octokit, octokitGraphql } from '../octokit';
import { removeLabelIfExists } from './remove-label';
Expand Down Expand Up @@ -90,18 +89,19 @@ export const manageMergeQueue = async ({ max_queue_size, login, slack_webhook_ur
};

export const removePrFromQueue = async (pullRequest: PullRequest) => {
await removeLabelIfExists(READY_FOR_MERGE_PR_LABEL, pullRequest.number);
const queueLabel = pullRequest.labels.find(label => label.name?.startsWith(QUEUED_FOR_MERGE_PREFIX))?.name;
if (queueLabel) {
await map([READY_FOR_MERGE_PR_LABEL, queueLabel], async label => await removeLabelIfExists(label, pullRequest.number));
await setCommitStatus({
sha: pullRequest.head.sha,
context: MERGE_QUEUE_STATUS,
state: 'pending',
description: 'This PR is not in the merge queue.'
});
const queuedPrs = await getQueuedPullRequests();
return updateMergeQueue(queuedPrs);
await removeLabelIfExists(queueLabel, pullRequest.number);
}
await setCommitStatus({
sha: pullRequest.head.sha,
context: MERGE_QUEUE_STATUS,
state: 'pending',
description: 'This PR is not in the merge queue.'
});
const queuedPrs = await getQueuedPullRequests();
return updateMergeQueue(queuedPrs);
};

const addPrToQueue = async (pullRequest: PullRequest, queuePosition: number, skip_auto_merge?: string) => {
Expand Down

0 comments on commit 3483bf7

Please sign in to comment.