This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
415 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { danger, fail } from "danger" | ||
import { validate } from "@roadiehq/roadie-backstage-entity-validator" | ||
|
||
const backstage = async () => { | ||
const pr = danger.github.pr | ||
const utils = danger.github.utils | ||
|
||
const isOpen = pr.state === "open" | ||
|
||
if (!isOpen) { | ||
return | ||
} | ||
|
||
const filePath = "catalog-info.yaml" | ||
const fileContent = await utils.fileContents(filePath, `${pr.head.user.login}/${pr.head.repo.name}`, pr.head.sha) | ||
|
||
if (fileContent) { | ||
try { | ||
await validate(fileContent, true, "./schemas/backstage.annotations.json") | ||
} catch (e) { | ||
fail(`The 'catalog-info.yaml' file is not valid for Backstage. Error details:\n\n\`\`\`\n${e}\n\`\`\``) | ||
} | ||
} else { | ||
fail(`The '${filePath}' file doesn't exist in the pull request.`) | ||
} | ||
} | ||
|
||
export default backstage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.