Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set conflicted PR numbers in output #396

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/autoupdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ConfigLoader } from './config-loader';
import { Output } from './Output';
import { isRequestError } from './helpers/isRequestError';

const OUTPUT_CONFLICTED_PR_NUMBERS = 'conflicted_pr_numbers';

type PullRequestResponse =
octokit.Endpoints['GET /repos/{owner}/{repo}/pulls/{pull_number}']['response'];
type MergeParameters =
Expand All @@ -30,6 +32,8 @@ export class AutoUpdater {
config: ConfigLoader;
octokit: InstanceType<typeof GitHub>;

private conflictingPrNumbers: string[] = [];

constructor(config: ConfigLoader, eventData: WebhookEvent) {
this.eventData = eventData;
this.config = config;
Expand Down Expand Up @@ -480,6 +484,16 @@ export class AutoUpdater {
if (e.message === 'Merge conflict') {
setOutputFn(Output.Conflicted, true);

const formattedPrNumber = `PR-#${prNumber}`;
this.conflictingPrNumbers.push(formattedPrNumber);

// Set the list as an output
setOutputFn(
OUTPUT_CONFLICTED_PR_NUMBERS,
this.conflictingPrNumbers.join(' ')
);


if (mergeConflictAction === 'ignore') {
// Ignore conflicts if configured to do so.
ghCore.info('Merge conflict detected, skipping update.');
Expand Down