Skip to content
Merged
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
19 changes: 16 additions & 3 deletions src/plugins/checks/IntegrationCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export async function IntegrationCheck(
// --------------------------------------------------------------------------------

// Check if the integration manifest exist in the repository
let manifest: any;
try {
var Integration = await context.github.repos.getContents({
owner: owner,
Expand All @@ -82,19 +83,31 @@ export async function IntegrationCheck(
path: (Integration as any).data[0].path + "/manifest.json",
});

var decoded = JSON.parse(
manifest = JSON.parse(
Base64.decode((IntegrationManifest as any).data["content"])
);
if (!decoded["domain"]) throw "wrong manifest";
if (!manifest["domain"]) throw "wrong manifest content";

Summary.summary += "\n✅ Integration manifest exist";
} catch (error) {
Summary.summary += "\n❌ [Integration manifest does not exist]";
Summary.summary += "\n❌ [Integration manifest does not exist, or is not valid JSON]";
Summary.summary +=
"(https://hacs.xyz/docs/publish/integration#repository-structure)";
conclusion = "failure";
}

if (manifest.includes("domain")) {
Summary.summary += "\n✅ Integration manifest includes 'domain'";
} else {
Summary.summary += "\n❌ Integration manifest does not includes 'domain'";
}

if (manifest.includes("documentation")) {
Summary.summary += "\n✅ Integration manifest includes 'documentation'";
} else {
Summary.summary += "\n❌ Integration manifest does not includes 'documentation'";
}

await context.github.checks.update(
context.issue({
head_sha: PRSHA,
Expand Down