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

Adds merge conflict label badge #151

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/components/utils/TestMergeRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ export default function TestMergeRow({
<FormattedMessage id="view.instance.repo.testmergelabel" />
</Badge>
) : null}
{pr.conflictlabel ? (
<Badge pill className="text-white text-capitalize mr-2" variant="danger">
<FormattedMessage id="view.instance.repo.conflictlabel" />
</Badge>
) : null}
</td>
<td>
<a href={pr.link} target="_blank" rel="noreferrer">
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/Instance/Edit/Repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,9 @@ class Repository extends React.Component<IProps, IState> {
if (a.testmergelabel !== b.testmergelabel) {
return a.testmergelabel ? -1 : 1;
}
if (a.conflictlabel !== b.conflictlabel) {
return a.conflictlabel ? 1 : -1;
}
return a.number - b.number;
}) ?? [];
const filteredPendingActions = sortedPRs
Expand Down
1 change: 1 addition & 0 deletions src/translations/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
"view.instance.repo.manual.desc": "Use this box to manually test merge a pull/merge request by entering its number and clicking \"Add Test Merge\"",
"view.instance.repo.addmanual": "Add Test Merge",
"view.instance.repo.testmergelabel": "Labelled",
"view.instance.repo.conflictlabel": "Merge Conflict",
"view.instance.repo.norepoinfo": "You lack the permission to display information about the repository",
"view.instance.repo.delete.title": "Delete Repository",
"view.instance.repo.delete.desc": "This will delete the local copy of the repository. Instance settings, code modifications, event scripts and static files will be preserved.",
Expand Down
4 changes: 3 additions & 1 deletion src/utils/GithubClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface PullRequest {
head: string;
tail: string;
testmergelabel: boolean;
conflictlabel: boolean;
}

type ExtractArrayType<A> = A extends Array<infer ArrayType> ? ArrayType : never;
Expand Down Expand Up @@ -221,7 +222,8 @@ const e = new (class GithubClient extends TypedEmitter<IEvents> {
label =>
label.name?.toLowerCase().includes("testmerge") ||
label.name?.toLowerCase().includes("test merge")
)
),
conflictlabel: pr.labels.some(label => label.name?.toLowerCase().includes("conflict"))
};
}

Expand Down