Github integration (#6414)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ function Gist(props: Props) {
|
||||
height="200px"
|
||||
scrolling="no"
|
||||
id={`gist-${id}`}
|
||||
title="Github Gist"
|
||||
title="GitHub Gist"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,8 @@
|
||||
"{{ count }} member": "{{ count }} member",
|
||||
"{{ count }} member_plural": "{{ count }} members",
|
||||
"Group members": "Group members",
|
||||
"{{authorName}} created <3></3>": "{{authorName}} created <3></3>",
|
||||
"{{authorName}} opened <3></3>": "{{authorName}} opened <3></3>",
|
||||
"Show menu": "Show menu",
|
||||
"Choose icon": "Choose icon",
|
||||
"Loading": "Loading",
|
||||
@@ -946,6 +948,14 @@
|
||||
"This month": "This month",
|
||||
"Last month": "Last month",
|
||||
"This year": "This year",
|
||||
"Connect": "Connect",
|
||||
"Whoops, you need to accept the permissions in GitHub to connect {{appName}} to your workspace. Try again?": "Whoops, you need to accept the permissions in GitHub to connect {{appName}} to your workspace. Try again?",
|
||||
"Something went wrong while authenticating your request. Please try logging in again.": "Something went wrong while authenticating your request. Please try logging in again.",
|
||||
"The owner of GitHub account has been requested to install the {{githubAppName}} GitHub app. Once approved, previews will be shown for respective links.": "The owner of GitHub account has been requested to install the {{githubAppName}} GitHub app. Once approved, previews will be shown for respective links.",
|
||||
"Enable previews of GitHub issues and pull requests in documents by connecting a GitHub organization or specific repositories to {appName}.": "Enable previews of GitHub issues and pull requests in documents by connecting a GitHub organization or specific repositories to {appName}.",
|
||||
"Enabled by {{integrationCreatedBy}}": "Enabled by {{integrationCreatedBy}}",
|
||||
"Disconnecting will prevent previewing GitHub links from this organization in documents. Are you sure?": "Disconnecting will prevent previewing GitHub links from this organization in documents. Are you sure?",
|
||||
"The GitHub integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The GitHub integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.",
|
||||
"Add to Slack": "Add to Slack",
|
||||
"document published": "document published",
|
||||
"document updated": "document updated",
|
||||
@@ -953,11 +963,9 @@
|
||||
"These events should be posted to Slack": "These events should be posted to Slack",
|
||||
"This will prevent any future updates from being posted to this Slack channel. Are you sure?": "This will prevent any future updates from being posted to this Slack channel. Are you sure?",
|
||||
"Whoops, you need to accept the permissions in Slack to connect {{appName}} to your workspace. Try again?": "Whoops, you need to accept the permissions in Slack to connect {{appName}} to your workspace. Try again?",
|
||||
"Something went wrong while authenticating your request. Please try logging in again.": "Something went wrong while authenticating your request. Please try logging in again.",
|
||||
"Personal account": "Personal account",
|
||||
"Link your {{appName}} account to Slack to enable searching the documents you have access to directly within chat.": "Link your {{appName}} account to Slack to enable searching the documents you have access to directly within chat.",
|
||||
"Disconnecting your personal account will prevent searching for documents from Slack. Are you sure?": "Disconnecting your personal account will prevent searching for documents from Slack. Are you sure?",
|
||||
"Connect": "Connect",
|
||||
"Slash command": "Slash command",
|
||||
"Get rich previews of {{ appName }} links shared in Slack and use the <em>{{ command }}</em> slash command to search for documents without leaving your chat.": "Get rich previews of {{ appName }} links shared in Slack and use the <em>{{ command }}</em> slash command to search for documents without leaving your chat.",
|
||||
"This will remove the Outline slash command from your Slack workspace. Are you sure?": "This will remove the Outline slash command from your Slack workspace. Are you sure?",
|
||||
|
||||
@@ -81,6 +81,7 @@ export enum IntegrationService {
|
||||
Grist = "grist",
|
||||
Slack = "slack",
|
||||
GoogleAnalytics = "google-analytics",
|
||||
GitHub = "github",
|
||||
}
|
||||
|
||||
export type UserCreatableIntegrationService = Extract<
|
||||
@@ -108,7 +109,15 @@ export enum DocumentPermission {
|
||||
}
|
||||
|
||||
export type IntegrationSettings<T> = T extends IntegrationType.Embed
|
||||
? { url: string }
|
||||
? {
|
||||
url: string;
|
||||
github?: {
|
||||
installation: {
|
||||
id: number;
|
||||
account: { id: number; name: string; avatarUrl: string };
|
||||
};
|
||||
};
|
||||
}
|
||||
: T extends IntegrationType.Analytics
|
||||
? { measurementId: string }
|
||||
: T extends IntegrationType.Post
|
||||
@@ -117,6 +126,14 @@ export type IntegrationSettings<T> = T extends IntegrationType.Embed
|
||||
? { serviceTeamId: string }
|
||||
:
|
||||
| { url: string }
|
||||
| {
|
||||
github?: {
|
||||
installation: {
|
||||
id: number;
|
||||
account: { id?: number; name: string; avatarUrl?: string };
|
||||
};
|
||||
};
|
||||
}
|
||||
| { url: string; channel: string; channelId: string }
|
||||
| { serviceTeamId: string }
|
||||
| { measurementId: string }
|
||||
@@ -257,6 +274,8 @@ export const NotificationEventDefaults = {
|
||||
export enum UnfurlType {
|
||||
Mention = "mention",
|
||||
Document = "document",
|
||||
Issue = "issue",
|
||||
Pull = "pull",
|
||||
}
|
||||
|
||||
export enum QueryNotices {
|
||||
@@ -265,20 +284,31 @@ export enum QueryNotices {
|
||||
|
||||
export type OEmbedType = "photo" | "video" | "rich";
|
||||
|
||||
export type Unfurl<T = OEmbedType> =
|
||||
| {
|
||||
url?: string;
|
||||
type: T;
|
||||
title: string;
|
||||
description?: string;
|
||||
thumbnailUrl?: string | null;
|
||||
meta?: Record<string, string>;
|
||||
}
|
||||
export type UnfurlResponse<S = OEmbedType, T = Record<string, any>> = {
|
||||
url?: string;
|
||||
type: S | ("issue" | "pull" | "commit");
|
||||
title: string;
|
||||
description?: string;
|
||||
createdAt?: string;
|
||||
thumbnailUrl?: string | null;
|
||||
author?: { name: string; avatarUrl: string };
|
||||
meta?: T;
|
||||
};
|
||||
|
||||
export type Unfurl =
|
||||
| UnfurlResponse
|
||||
| {
|
||||
error: string;
|
||||
};
|
||||
|
||||
export type UnfurlSignature = (url: string) => Promise<Unfurl | false>;
|
||||
export type UnfurlSignature = (
|
||||
url: string,
|
||||
actor?: any
|
||||
) => Promise<Unfurl | void>;
|
||||
|
||||
export type UninstallSignature = (
|
||||
integration: Record<string, any>
|
||||
) => Promise<void>;
|
||||
|
||||
export type JSONValue =
|
||||
| string
|
||||
|
||||
@@ -35,3 +35,17 @@ export const stringToColor = (input: string) => {
|
||||
*/
|
||||
export const toRGB = (color: string) =>
|
||||
Object.values(parseToRgb(color)).join(", ");
|
||||
|
||||
/**
|
||||
* Returns the text color that contrasts the given background color
|
||||
*
|
||||
* @param background - A color string
|
||||
* @returns A color string
|
||||
*/
|
||||
export const getTextColor = (background: string) => {
|
||||
const r = parseInt(background.substring(1, 3), 16);
|
||||
const g = parseInt(background.substring(3, 5), 16);
|
||||
const b = parseInt(background.substring(5, 7), 16);
|
||||
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
||||
return yiq >= 128 ? "black" : "white";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user