Skip to content

Commit af17b87

Browse files
committed
feat: add fortSphere policies index page
1 parent 2e8dc4c commit af17b87

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
sidebar_position: 4
3+
title: Policies
4+
slug: /fortSphere/policies
5+
---
6+
7+
Here you can find an updated list with all the policies available in the latest version:
8+
<!-- LIST:START -->
9+
<!-- LIST:START -->
10+
- Restrict Repository Creation ([restrictRepoCreationGitHub](/docs/policies/restrictRepoCreationGitHub))
11+
<!-- LIST:END -->
12+
<!-- LIST:END -->
13+
<!-- LIST:END -->
14+
<!-- LIST:END -->
15+
<!-- LIST:END -->
16+
<!-- LIST:END -->

scripts/populate-policies.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const descriptionStartTag = '<!-- DESCRIPTION:START -->'
77
const descriptionEndTag = '<!-- DESCRIPTION:END -->'
88
const technicalDetailsStartTag = '<!-- TECHNICAL-DETAILS:START -->'
99
const technicalDetailsEndTag = '<!-- TECHNICAL-DETAILS:END -->'
10+
const listStartTag = '<!-- LIST:START -->'
11+
const listEndTag = '<!-- LIST:END -->'
1012

1113
// @TODO: Move this function to a shared file
1214
const replaceMetadata = (fileContent, metadata) => {
@@ -60,4 +62,25 @@ ${technicalDetailsEndTag}
6062
updateContent(currentFileContent)
6163
}
6264
writeFileSync(destination, fileContent)
63-
})
65+
})
66+
67+
// Update the policies list
68+
const policiesList = policies.map((policy) => {
69+
return `- ${policy.title} ([${policy.name}](/docs/policies/${policy.name}))`
70+
}).join('\n')
71+
72+
const policiesListContent = `${listStartTag}
73+
${policiesList}
74+
${listEndTag}`
75+
76+
const policiesListDestination = path.join(process.cwd(), 'docs/projects/fortSphere/policies.md')
77+
policiesListFileContent = readFileSync(policiesListDestination, 'utf8')
78+
79+
policiesListFileContent = updateOrCreateSegment({
80+
original: policiesListFileContent,
81+
replacementSegment: policiesListContent,
82+
startTag: listStartTag,
83+
endTag: listEndTag
84+
})
85+
86+
writeFileSync(policiesListDestination, policiesListFileContent)

0 commit comments

Comments
 (0)