@@ -20409,6 +20409,34 @@ const loadData = async ({ notion }) => {
2040920409exports.loadData = loadData
2041020410
2041120411
20412+ /***/ }),
20413+
20414+ /***/ 4154:
20415+ /***/ ((__unused_webpack_module, exports) => {
20416+
20417+ const getDependsOn = async (dependsOn, { notion, database }) => {
20418+ const dependencies = []
20419+ for (const dependency of dependsOn) {
20420+ // Lets see if we can find the row
20421+ const search = await notion.databases.query({
20422+ database_id: database,
20423+ filter: {
20424+ property: 'Name',
20425+ text: {
20426+ equals: dependency
20427+ }
20428+ }
20429+ })
20430+ if (search.results.length > 0) {
20431+ dependencies.push({ id: search.results[0].id })
20432+ }
20433+ }
20434+ return dependencies
20435+ }
20436+
20437+ exports.getDependsOn = getDependsOn
20438+
20439+
2041220440/***/ }),
2041320441
2041420442/***/ 3504:
@@ -20461,6 +20489,18 @@ const getRepos = async () => {
2046120489 }
2046220490 }
2046320491 }
20492+
20493+ // Now we want to sort the repositories based on their name, and the number of dependencies
20494+ repoData.sort((a, b) => {
20495+ const aDependsOn = a.spec?.dependsOn?.length || 0
20496+ const bDependsOn = b.spec?.dependsOn?.length || 0
20497+ const aSort = aDependsOn + '.' + a._repo.name
20498+ const bSort = bDependsOn + '.' + b._repo.name
20499+ if (aSort < bSort) return -1
20500+ if (aSort > bSort) return 1
20501+ return 0
20502+ })
20503+
2046420504 core.info(`Processed ${repoData.length} matching repositories`)
2046520505 return repoData
2046620506}
@@ -20580,6 +20620,7 @@ exports.ensureLinks = ensureLinks
2058020620
2058120621const core = __nccwpck_require__(272)
2058220622const { ensureLinks } = __nccwpck_require__(5475)
20623+ const { getDependsOn } = __nccwpck_require__(4154)
2058320624
2058420625const updateServices = async (repositories, { notion, database, systems, owners }) => {
2058520626 for (const repo of repositories) {
@@ -20608,9 +20649,13 @@ const updateServices = async (repositories, { notion, database, systems, owners
2060820649
2060920650const updateNotionRow = async (repo, pageId, { notion, database, systems, owners }) => {
2061020651 try {
20652+ let dependsOn = []
20653+ if (repo.spec?.dependsOn?.length > 0) {
20654+ dependsOn = await getDependsOn(repo.spec.dependsOn, { notion, database })
20655+ }
2061120656 await notion.pages.update({
2061220657 page_id: pageId,
20613- properties: createProperties(repo, { systems, owners })
20658+ properties: createProperties(repo, dependsOn, { systems, owners })
2061420659 })
2061520660 if (repo.metadata?.links) {
2061620661 await ensureLinks(pageId, repo.metadata.links, { notion })
@@ -20622,11 +20667,15 @@ const updateNotionRow = async (repo, pageId, { notion, database, systems, owners
2062220667
2062320668const createNotionRow = async (repo, { notion, database, systems, owners }) => {
2062420669 try {
20670+ let dependsOn = []
20671+ if (repo.spec?.dependsOn?.length > 0) {
20672+ dependsOn = await getDependsOn(repo.spec.dependsOn, { notion, database })
20673+ }
2062520674 const page = await notion.pages.create({
2062620675 parent: {
2062720676 database_id: database
2062820677 },
20629- properties: createProperties(repo, { systems, owners })
20678+ properties: createProperties(repo, dependsOn, { systems, owners })
2063020679 })
2063120680 if (repo.metadata?.links) {
2063220681 await ensureLinks(page.id, repo.metadata.links, { notion })
@@ -20636,7 +20685,7 @@ const createNotionRow = async (repo, { notion, database, systems, owners }) => {
2063620685 }
2063720686}
2063820687
20639- const createProperties = (repo, { systems, owners }) => {
20688+ const createProperties = (repo, dependsOn, { systems, owners }) => {
2064020689 let owner, system
2064120690 const ownerSpec = repo?.spec?.owner
2064220691 const systemSpec = repo?.spec?.system
@@ -20702,6 +20751,7 @@ const createProperties = (repo, { systems, owners }) => {
2070220751 },
2070320752 Owner: owner,
2070420753 System: system,
20754+ DependsOn: { relation: dependsOn },
2070520755 Visibility: {
2070620756 select: {
2070720757 name: repo._repo.visibility
@@ -20712,6 +20762,11 @@ const createProperties = (repo, { systems, owners }) => {
2071220762 name: repo._repo.language || 'Unknown'
2071320763 }
2071420764 },
20765+ Lifecycle: {
20766+ select: {
20767+ name: repo.spec?.lifecycle || 'Unknown'
20768+ }
20769+ },
2071520770 Status: {
2071620771 select: {
2071720772 name: repo.status
0 commit comments