mirror of
https://github.com/outline/outline.git
synced 2026-11-26 15:43:48 +03:00
Utilize GitHub integration to fetch information about public issues/PRs (#10827)
* fix: use github APIs to unfurl public gh issues/prs * fix: revert * fix: multiple gh accounts * fix: use replacements
This commit is contained in:
1 parent
d5dbf286cc
commit
948e557bdd
2 files changed
+15
-9
No files matched your search
@@ -4,6 +4,7 @@ import {
|
||||
type OAuthWebFlowAuthOptions,
|
||||
type InstallationAuthOptions,
|
||||
} from "@octokit/auth-app";
|
||||
import { Sequelize } from "sequelize";
|
||||
import { Endpoints, OctokitResponse } from "@octokit/types";
|
||||
import { Octokit } from "octokit";
|
||||
import pluralize from "pluralize";
|
||||
@@ -229,11 +230,22 @@ export class GitHub {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find integration, prioritizing one where the installation account matches the resource owner
|
||||
const integration = (await Integration.findOne({
|
||||
where: {
|
||||
service: IntegrationService.GitHub,
|
||||
teamId: actor.teamId,
|
||||
"settings.github.installation.account.name": resource.owner,
|
||||
},
|
||||
order: [
|
||||
[
|
||||
Sequelize.literal(
|
||||
`CASE WHEN "settings"->'github'->'installation'->'account'->>'name' = :owner THEN 0 ELSE 1 END`
|
||||
),
|
||||
"ASC",
|
||||
],
|
||||
],
|
||||
replacements: {
|
||||
owner: resource.owner,
|
||||
},
|
||||
})) as Integration<IntegrationType.Embed>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user