[DO NOT MERGE] GitHub AE consumables beta megabranch (#17620)
* Empty commit * updated beta note for GHAE * more GHAE update + resolve conflict * more GHAE updates + prepare for screenshots * Apply suggestions from code review Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> * address remaining review comments * Revise "About GitHub AE" (#17679) * add screenshots to the Configuring article * reworked to have a separate GHAE section * list numbering * more work on screenshots and conditions * add GHAE screenshots in article * review screenshots in article * added more screenshots and updated more articles * screenshot madness * fix liquid versioning * refactor the ghae script * [GHAE CB/Feb 22]: Add article about data residency for GitHub AE (#17847) * add missing GHAE versioning to article * move screenshots to GHAE asset directory * forgot to change the path for these two images * replace CBB screenshot + add better screenshot * [GHAE CB/Feb 22]: Document upgrades for GitHub AE (#17848) * Version article for GitHub AE * Replace unused variable * Incorporate reviewer feedback * Update intro Co-authored-by: Ethan P <56270045+ethanpalm@users.noreply.github.com> * [GHAE] Enable IP allow list (#17691) * Notes for CC * Updat permission leves chart * Add updated article to further reading * Update gated feature callout with GitHub AE * Version "Managing allowed IP addresses for your organization" for AE * Update images * Update "Restricting network traffic to your enterprise" with new procedures * remove todo note * Update audited actions * Update info about Premium Runners * Use reusable for Premium Runners * Change "Premium Runners" to "AE hosted runners" * Incorporate reviewer feedback * Use correct reusable * Version reusable correctly * [Feb 22] GHAE: Code scanning beta (#17830) * Add "github-ae" to all the frontmatter * GHAE-ify the reusables * Add some more changes * Re-use some content * 🔪 Semmle links * Revert change re "--external-repository-token" in the CodeQL runner * Update CodeQL runner token scopes * Update two screenshots * Remove mention of GitHub.com from AE + other fixes * Apply suggestions from code review Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> * Use `product_name` variable instead of `product_location` * Remove confusing phrase * [Feb 22] GHAE: Code scanning API and webhook docs (#17883) * Version API and webhook docs * Actually add versioning for GHAE * Fix anchor * [TEMPORARY] Preview for API endpoints * Revert API previews * Update procedure step Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> * Update docs for AzureAD Group SCIM support in GHAE (#17892) * [GHAE CB] SMTP bootstrapping flow (#17888) * draft * update with AE conntent * update with tons of versioning * remove that lie * fill out the rest of these steps * update with correct versioning * more edits * add images * reversion most of ae article * fix versioning * format correctlly * words matter * last image * update with permmissions * update versioning * add link * apply feedback ❤️ * update with differrent spacing * update with feedback * more feedback * Temporary GHAE release notes for consumables beta launch (#17859) * Create release-notes.md * Add frontmatter * Add to index file * Update github-ae-release-notes.md * Add release notes from Google Doc * Update finalized docs links that have been reviewed * OAuth device flow link update * version for AE * few fixes * Update content/admin/overview/github-ae-release-notes.md * small edits * whoops * commit * update with different links * used wrong reusable * fix more brokenness * Update repository-references.js * Update repository-references.js Co-authored-by: Meg Bird <megbird@github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * [GHAE] Audit public repos (#17917) * verifying what we mean by public * Apply suggestions from code review * Update content/developers/apps/installing-github-apps.md Co-authored-by: Laura Coursen <lecoursen@github.com> * fixing placememnt of liquid conditional Co-authored-by: Laura Coursen <lecoursen@github.com> * GHAE packages beta (#17786) Co-authored-by: jmarlena <6732600+jmarlena@users.noreply.github.com> Co-authored-by: Martin Lopes <martin389@github.com> * fix broken links * [GHAE CB/March 01]: GitHub Actions on GHAE (beta) (#17725) * Added initial layout for premium runners * Restructured content * Added placeholder for removing premium runner * Added versioning and warning note for self-hosted runners * Added versioning and beta notice for actions content * Rephrased beta note * Added versioning for API docs, fixes * Added versioning fixes * Split Github-hosted and premium topics into separate articles * Added edits * Restructured some topics * Revised "Using premium runners in a workflow" * Some small fixes * Fixed typo * Added fixes to reusable * Added edits * Made section titles consistent * Added billing, group mgmt, reusable steps * Cropped certain screenshots for future-proofing * Removed superfluous reusable * Added fixes * Revert "Cropped certain screenshots for future-proofing" This reverts commit c7f24f31fa30d4fe3de2b63fc3cd5feba44ef518. * Added new section for custom images * Added versioning for enterprise-admin operations * Added edits * Added edits * Update adding-premium-runners.md * Removed SHR screenshots. Intending to update them when UI is available. * Update using-labels-with-premium-runners.md * Added custom labels section * Added preview of API docs changes * Added versioning for ip allow list section * Removed removal article * Renamed premium runners to AE hosted runners * Re-added added API preview * Fixed links, updated software specs * Revised "Software specifications" based on feedback * Fixed typos * Small fixes * Added new article "Creating custom images" * Moved "Creating custom images" link * Apply suggestions from code review Co-authored-by: ahdbilal <55514721+ahdbilal@users.noreply.github.com> * Added update from review * Added updates from tech review * Apply suggestions from code review Co-authored-by: ahdbilal <55514721+ahdbilal@users.noreply.github.com> * Added updates from tech review * Added updates from tech review * Added updates from tech review * Added updates from tech review * Fixed reusable * Added fixes * Added update from tech review * Removed the dereferenced OpenAPI schema files * Added fixes * Fixed links * Fixed links * Apply suggestions from code review Co-authored-by: jmarlena <6732600+jmarlena@users.noreply.github.com> * Added updates from peer review * Removed sections that are not in beta * Update viewing-your-github-actions-usage.md * Update viewing-job-execution-time.md * Update index.md * Update about-github-hosted-runners.md * Restored versioning to match GHES approach * Fixed link * Restored self-hosted runner reference to UI steps. * Updated screenshots * Updated screenshots and procedures * Small edits to screenshots * Added AE url info for SHR * Removed superfluous versioning * Update security-hardening-for-github-actions.md * Update actions-shared.md * Small edits * Update usage-limits-billing-and-administration.md * Update managing-complex-workflows.md * Additional versioning * Additional versioning * version environments api and checkrun deployments for ghae (#17991) Co-authored-by: Martin Lopes <martin389@github.com> * Update reviewing-the-audit-log-for-your-organization.md * Added versioning for enterprise policy settings * version configuring artifact retention for AE * remove AE versioning for connecting to Marketplace * Apply suggestions from code review Co-authored-by: Joe Bourne <thejoebourneidentity@github.com> * Update content/admin/github-actions/getting-started-with-github-actions-for-github-ae.md Co-authored-by: Joe Bourne <thejoebourneidentity@github.com> * rewording not public to private * fixing liquid * Fixed elseif entries * Added expectations note * Revised label management article for AE hosted runners * Added enterprise-admin note for adding AE hosted runners * Update enterprise-admin.md * Update self-hosted-runner-security.md * Versioned reusable for AE * Empty commit for CI Co-authored-by: ahdbilal <55514721+ahdbilal@users.noreply.github.com> Co-authored-by: jmarlena <6732600+jmarlena@users.noreply.github.com> Co-authored-by: skedwards88 <skedwards88@github.com> Co-authored-by: Leona B. Campbell <3880403+runleonarun@users.noreply.github.com> Co-authored-by: Joe Bourne <thejoebourneidentity@github.com> Co-authored-by: runleonarun <runleonarun@github.com> * Update OpenAPI Descriptions for GHAE * Update content/admin/overview/github-ae-release-notes.md Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> Co-authored-by: mchammer01 <42146119+mchammer01@users.noreply.github.com> Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> Co-authored-by: shati-patel <shati-patel@github.com> Co-authored-by: Sarah Schneider <sarahs@github.com> Co-authored-by: skedwards88 <skedwards88@github.com> Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com> Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com> Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Meg Bird <megbird@github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: Leona B. Campbell <3880403+runleonarun@users.noreply.github.com> Co-authored-by: Laura Coursen <lecoursen@github.com> Co-authored-by: jmarlena <6732600+jmarlena@users.noreply.github.com> Co-authored-by: Martin Lopes <martin389@github.com> Co-authored-by: ahdbilal <55514721+ahdbilal@users.noreply.github.com> Co-authored-by: Joe Bourne <thejoebourneidentity@github.com> Co-authored-by: runleonarun <runleonarun@github.com> Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com>
This commit is contained in:
@@ -14,7 +14,7 @@ const versionSatisfiesRange = require('../../lib/version-satisfies-range')
|
||||
// [start-readme]
|
||||
//
|
||||
// Run this script to add versions frontmatter and Liquid conditionals for
|
||||
// GitHub AE, based on anything currently versioned for the provided release
|
||||
// GitHub AE, based on anything currently versioned for the specified release
|
||||
// of Enterprise Server. This script should be run as part of the Enterprise
|
||||
// Server release process.
|
||||
//
|
||||
@@ -23,28 +23,23 @@ const versionSatisfiesRange = require('../../lib/version-satisfies-range')
|
||||
program
|
||||
.description('Add versions frontmatter and Liquid conditionals for GitHub AE based on a given Enterprise Server release. Runs on all content by default.')
|
||||
.option('-r, --ghes-release <RELEASE>', 'The Enterprise Server release to base AE versioning on. Example: 2.23')
|
||||
.option('-p, --products [PRODUCT_IDS...]', 'List of space-separated product IDs. Example: admin github developers')
|
||||
.option('-c, --currentServerReleases', 'Also add AE versioning to conditionals for current Enterprise Server releases.')
|
||||
.option('-t, --translations', 'Run the script on content and data in translations, too.')
|
||||
.option('-p, --products [OPTIONAL PRODUCT_IDS...]', 'Optional list of space-separated product IDs. Example: admin github developers')
|
||||
.option('-t, --translations', 'Run the script on content and data in translations too.')
|
||||
.parse(process.argv)
|
||||
|
||||
if (!program.ghesRelease) {
|
||||
console.log('Must provide an Enterprise Server release number!')
|
||||
process.exit()
|
||||
console.error('Must provide an Enterprise Server release number!')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(`✅ Adding AE versioning based on GHES ${program.ghesRelease} versioning`)
|
||||
|
||||
if (program.products) {
|
||||
console.log(`✅ Running on the following products: ${program.products}`)
|
||||
} else {
|
||||
console.log('✅ Running on all products')
|
||||
}
|
||||
|
||||
if (program.currentServerReleases) {
|
||||
console.log(`✅ Adding AE versioning based on GHES ${program.ghesRelease} versioning and all currently supported GHES versions`)
|
||||
} else {
|
||||
console.log(`✅ Adding AE versioning based only on GHES ${program.ghesRelease} versioning`)
|
||||
}
|
||||
|
||||
if (program.translations) {
|
||||
console.log('✅ Running on both English and translated content and data\n')
|
||||
} else {
|
||||
@@ -54,17 +49,14 @@ if (program.translations) {
|
||||
// The new conditional to add
|
||||
const githubAEConditional = 'currentVersion == "github-ae@latest"'
|
||||
|
||||
// Existing conditionals to hook on (if program.currentServerReleases is true)
|
||||
const notDotcomConditional = /currentVersion != "free-pro-team@latest" (or)?(?!and)/
|
||||
const allGHESVersionsConditional = /enterpriseServerVersions contains currentVersion (or)?/
|
||||
|
||||
// Match: currentVersion <operator> "enterprise-server@(\d+\.\d+)"
|
||||
const getEnterpriseServerConditional = new RegExp(`currentVersion (\\S+?) "${getEnterpriseServerNumber.source}"`)
|
||||
// Example: currentVersion ver_gt "enterprise-server@2.21"
|
||||
const enterpriseServerConditionalRegex = new RegExp(`currentVersion (\\S+?) "${getEnterpriseServerNumber.source}"`)
|
||||
|
||||
console.log('Working...\n')
|
||||
|
||||
const englishContentFiles = walkContent(contentPath)
|
||||
const englishDataFiles = walkData(dataPath, englishContentFiles)
|
||||
const englishDataFiles = walkData(dataPath)
|
||||
|
||||
function walkContent (dirPath) {
|
||||
const products = program.products || ['']
|
||||
@@ -77,7 +69,7 @@ function walkContent (dirPath) {
|
||||
}).flat()
|
||||
}
|
||||
|
||||
function walkData (dirPath, contentFiles) {
|
||||
function walkData (dirPath) {
|
||||
return walk(dirPath, { includeBasePath: true, directories: false })
|
||||
.filter(file => file.includes('/data/reusables') || file.includes('/data/variables'))
|
||||
.filter(file => !file.endsWith('README.md'))
|
||||
@@ -86,7 +78,7 @@ function walkData (dirPath, contentFiles) {
|
||||
let allContentFiles, allDataFiles
|
||||
if (program.translations) {
|
||||
const translatedContentFiles = walkContent(translationsPath)
|
||||
const translatedDataFiles = walkData(translationsPath, translatedContentFiles)
|
||||
const translatedDataFiles = walkData(translationsPath)
|
||||
allContentFiles = englishContentFiles.concat(translatedContentFiles)
|
||||
allDataFiles = englishDataFiles.concat(translatedDataFiles)
|
||||
} else {
|
||||
@@ -101,16 +93,21 @@ const operators = {
|
||||
'==': '='
|
||||
}
|
||||
|
||||
// Update the data files
|
||||
allDataFiles
|
||||
.forEach(file => {
|
||||
const dataContent = fs.readFileSync(file, 'utf8')
|
||||
|
||||
const conditionalsToUpdate = getConditionalsToUpdate(dataContent)
|
||||
if (!conditionalsToUpdate.length) return
|
||||
|
||||
// Update Liquid in data files
|
||||
const newDataContent = updateLiquid(dataContent, file)
|
||||
const newDataContent = updateLiquid(conditionalsToUpdate, dataContent)
|
||||
|
||||
fs.writeFileSync(file, newDataContent)
|
||||
})
|
||||
|
||||
// Update the content files
|
||||
allContentFiles
|
||||
.forEach(file => {
|
||||
const { data, content } = frontmatter(fs.readFileSync(file, 'utf8'))
|
||||
@@ -118,63 +115,42 @@ allContentFiles
|
||||
// Return early if the current page frontmatter does not apply to either GHAE or the given GHES release
|
||||
if (!(data.versions['github-ae'] || versionSatisfiesRange(program.ghesRelease, data.versions['enterprise-server']))) return
|
||||
|
||||
// Add frontmatter version
|
||||
data.versions['github-ae'] = '*'
|
||||
const conditionalsToUpdate = getConditionalsToUpdate(content)
|
||||
if (!conditionalsToUpdate.length) return
|
||||
|
||||
// Update Liquid in content files
|
||||
const newContent = updateLiquid(content, file)
|
||||
const newContent = updateLiquid(conditionalsToUpdate, content)
|
||||
|
||||
// Add frontmatter version
|
||||
data.versions['github-ae'] = '*'
|
||||
|
||||
// Update Liquid in frontmatter props
|
||||
Object.keys(data)
|
||||
.filter(key => typeof data[key] === 'string')
|
||||
.forEach(key => {
|
||||
data[key] = updateLiquid(data[key], file)
|
||||
const conditionalsToUpdate = getConditionalsToUpdate(data[key])
|
||||
if (!conditionalsToUpdate.length) return
|
||||
data[key] = updateLiquid(conditionalsToUpdate, data[key])
|
||||
})
|
||||
|
||||
fs.writeFileSync(file, frontmatter.stringify(newContent, data, { lineWidth: 10000 }))
|
||||
})
|
||||
|
||||
function updateLiquid (content, file) {
|
||||
// We need to match on all conditionals first because we have to do replacements _within_ conditionals
|
||||
function getConditionalsToUpdate (content) {
|
||||
const allConditionals = content.match(/{% if .+?%}/g)
|
||||
if (!allConditionals) return content
|
||||
|
||||
return (allConditionals || [])
|
||||
.filter(conditional => !conditional.includes('github-ae'))
|
||||
.filter(conditional => doesReleaseSatisfyConditional(conditional.match(enterpriseServerConditionalRegex)))
|
||||
}
|
||||
|
||||
function updateLiquid (conditionalsToUpdate, content) {
|
||||
let newContent = content
|
||||
|
||||
allConditionals.forEach(conditional => {
|
||||
// Do not process a conditional that already includes github-ae
|
||||
if (conditional.includes('github-ae')) return
|
||||
|
||||
conditionalsToUpdate.forEach(conditional => {
|
||||
let newConditional = conditional
|
||||
|
||||
// Example match: currentVersion ver_gt "enterprise-server@2.21"
|
||||
const enterpriseServerMatch = newConditional.match(getEnterpriseServerConditional)
|
||||
|
||||
// Add AE conditional to any `currentVersion != "free-pro-team@latest"`
|
||||
if (program.currentServerReleases && newConditional.match(notDotcomConditional)) {
|
||||
if (enterpriseServerMatch && !doesReleaseSatisfyConditional(enterpriseServerMatch)) return
|
||||
|
||||
newConditional = newConditional.replace(/( ?)%}/, `$1or ${githubAEConditional} %}`)
|
||||
newContent = newContent.replace(conditional, newConditional)
|
||||
return
|
||||
}
|
||||
|
||||
// Add AE conditional to any `enterpriseServerVersions contains currentVersion`
|
||||
if (program.currentServerReleases && newConditional.match(allGHESVersionsConditional)) {
|
||||
if (enterpriseServerMatch && !doesReleaseSatisfyConditional(enterpriseServerMatch)) return
|
||||
|
||||
newConditional = newConditional.replace(/( ?)%}/, `$1or ${githubAEConditional} %}`)
|
||||
newContent = newContent.replace(conditional, newConditional)
|
||||
return
|
||||
}
|
||||
|
||||
// Add AE conditional to any conditional that applies to enterprise-server@<provided-release>
|
||||
if (!enterpriseServerMatch) return
|
||||
|
||||
const releaseSatisfiesConditional = doesReleaseSatisfyConditional(enterpriseServerMatch)
|
||||
|
||||
// Return early if the conditional does not apply to the given GHES release
|
||||
if (!releaseSatisfiesConditional) return
|
||||
const enterpriseServerMatch = conditional.match(enterpriseServerConditionalRegex)
|
||||
|
||||
// First do the replacement within the conditional
|
||||
// Old: {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
|
||||
@@ -191,6 +167,8 @@ function updateLiquid (content, file) {
|
||||
console.log('Done!')
|
||||
|
||||
function doesReleaseSatisfyConditional (enterpriseServerMatch) {
|
||||
if (!enterpriseServerMatch) return
|
||||
|
||||
// Example liquid operator: ver_gt
|
||||
const liquidOperator = enterpriseServerMatch[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user