UNPKG

@roadiehq/backstage-plugin-github-insights

Version:
20 lines (18 loc) 704 B
const GITHUB_PROJECT_ANNOTATION = "github.com/project-slug"; const GITHUB_README_ANNOTATION = "github.com/project-readme-path"; const useProjectEntity = (entity) => { const projectSlug = entity.metadata?.annotations?.[GITHUB_PROJECT_ANNOTATION]; const readmePath = entity.metadata?.annotations?.[GITHUB_README_ANNOTATION]; if (!projectSlug && projectSlug === "") { throw new Error( `No "${GITHUB_PROJECT_ANNOTATION}" annotation found for your entity ${entity.metadata.name}` ); } return { owner: projectSlug?.split("/")[0] || "", repo: projectSlug?.split("/")[1] || "", readmePath }; }; export { useProjectEntity }; //# sourceMappingURL=useProjectEntity.esm.js.map