Skip to content

Commit

Permalink
Review comments + casing
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Dec 1, 2023
1 parent 54315e9 commit c95cc03
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 66 deletions.
24 changes: 12 additions & 12 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,20 @@ function ReadSettings {
"environments" = @()
"buildModes" = @()
"useCompilerFolder" = $false
"PullRequestTrigger" = "pull_request_target"
"pullRequestTrigger" = "pull_request_target"
"fullBuildPatterns" = @()
"excludeEnvironments" = @()
"ALDoc" = [ordered]@{
"ContinuousDeployment" = $false
"DeployToGitHubPages" = $true
"MaxReleases" = 3
"UseProjectsAsFolders" = $true
"Projects" = @()
"ExcludeProjects" = @()
"Header" = "Documentation for {REPOSITORY} {VERSION}"
"Footer" = "Documentation for <a href=""https://github.com/{REPOSITORY}"">{REPOSITORY}</a> made with <a href=""https://aka.ms/AL-Go"">AL-Go for GitHub</a>, <a href=""https://go.microsoft.com/fwlink/?linkid=2247728"">ALDoc</a> and <a href=""https://dotnet.github.io/docfx"">DocFx</a>"
"DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}"
"DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}"
"alDoc" = [ordered]@{
"continuousDeployment" = $false
"deployToGitHubPages" = $true
"maxReleases" = 3
"useProjectsAsFolders" = $true
"includeProjects" = @()
"excludeProjects" = @()
"header" = "Documentation for {REPOSITORY} {VERSION}"
"footer" = "Documentation for <a href=""https://github.com/{REPOSITORY}"">{REPOSITORY}</a> made with <a href=""https://aka.ms/AL-Go"">AL-Go for GitHub</a>, <a href=""https://go.microsoft.com/fwlink/?linkid=2247728"">ALDoc</a> and <a href=""https://dotnet.github.io/docfx"">DocFx</a>"
"defaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the alDoc:defaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}"
"defaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the alDoc:defaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ function GenerateDocsSite {
function CalculateProjectsAndApps {
Param(
[string] $tempFolder,
[string[]] $projects,
[string[]] $includeProjects,
[string[]] $excludeProjects,
[switch] $useProjectsAsFolders
)

if ($projects.Count -eq 0) { $projects = @("*") }
$projectList = @($projects | ForEach-Object { $_.Replace('\','_').Replace('/','_') })
if ($includeProjects.Count -eq 0) { $includeProjects = @("*") }
$projectList = @($includeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') })
Write-Host "Include Project Patterns"
$projectList | ForEach-Object { Write-Host "- $_" }
$excludeProjectList = @($excludeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') })
Expand Down
24 changes: 12 additions & 12 deletions Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
DownloadAndImportBcContainerHelper

$settings = $env:Settings | ConvertFrom-Json
$projects = $settings.ALDoc.Projects
$excludeProjects = $settings.ALDoc.ExcludeProjects
$maxReleases = $settings.ALDoc.MaxReleases
$includeProjects = $settings.alDoc.includeProjects
$excludeProjects = $settings.alDoc.excludeProjects
$maxReleases = $settings.alDoc.maxReleases
$artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts"
$artifactsFolderCreated = $false
if ($artifacts -ne ".artifacts") {
Expand All @@ -32,10 +32,10 @@ if ($artifacts -ne ".artifacts") {
}
}

$header = $settings.ALDoc.Header
$footer = $settings.ALDoc.Footer
$defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n")
$defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n")
$header = $settings.alDoc.header
$footer = $settings.alDoc.footer
$defaultIndexMD = $settings.alDoc.defaultIndexMD.Replace('\n',"`n")
$defaultReleaseMD = $settings.alDoc.defaultReleaseMD.Replace('\n',"`n")

$releases = @()
if ($maxReleases -gt 0) {
Expand All @@ -54,14 +54,14 @@ foreach($release in $releases) {
New-Item -Path $tempFolder -ItemType Directory | Out-Null
try {
foreach($mask in 'Apps', 'Dependencies') {
DownloadRelease -token $token -projects "$($projects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack
DownloadRelease -token $token -projects "$($includeProjects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack
}
Write-Host "Version: $($release.Name):"
Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" }
$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders
$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders
$version = $release.Name
$releaseNotes = $release.body
GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders
GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders
do {
try {
$retry = $false
Expand All @@ -85,7 +85,7 @@ foreach($version in $versions) {
}

Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" }
$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders
$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders
$releaseNotes = ''
if ($latestReleaseTag) {
try {
Expand All @@ -98,7 +98,7 @@ if ($latestReleaseTag) {
else {
$releaseNotes = ''
}
GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders
GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders

if ($artifactsFolderCreated) {
Remove-Item $artifactsFolder -Recurse -Force
Expand Down
6 changes: 3 additions & 3 deletions Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ function ModifyPullRequestHandlerWorkflow {
[Yaml] $yaml,
[hashtable] $repoSettings
)
# The PullRequestHandler workflow can have a RepoSetting called PullRequestTrigger which specifies the trigger to use for Pull Requests
# The PullRequestHandler workflow can have a RepoSetting called pullRequestTrigger which specifies the trigger to use for Pull Requests
$triggerSection = $yaml.Get('on:/pull')
$triggerSection.content = "$($repoSettings.PullRequestTrigger):"
$triggerSection.content = "$($repoSettings.pullRequestTrigger):"
$yaml.Replace('on:/pull', $triggerSection.Content)

# The PullRequestHandler workflow can have a RepoSetting called CICDPullRequestBranches, which will be used to set the branches for the workflow
Expand All @@ -92,7 +92,7 @@ function ModifyPullRequestHandlerWorkflow {
}

# update the branches: line with the new branches
$yaml.Replace("on:/$($repoSettings.PullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]")
$yaml.Replace("on:/$($repoSettings.pullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]")
}

function ModifyRunsOnAndShell {
Expand Down
2 changes: 1 addition & 1 deletion Actions/Deploy/Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ try {
Write-Host "Publishing apps using development endpoint"
Publish-BcContainerApp @parameters -useDevEndpoint -checkAlreadyInstalled -excludeRuntimePackages
}
elseif (!$sandboxEnvironment -and $type -eq 'CD' -and !($deploymentSettings.ContinuousDeployment)) {
elseif (!$sandboxEnvironment -and $type -eq 'CD' -and !($deploymentSettings.continuousDeployment)) {
# Continuous deployment is undefined in settings - we will not deploy to production environments
Write-Host "::Warning::Ignoring environment $($deploymentSettings.EnvironmentName), which is a production environment"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ function Get-BranchesFromPolicy($ghEnvironment) {

$settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable -recurse

$generateALDocArtifact = ($type -eq 'Publish') -or $settings.ALDoc.ContinuousDeployment
$generateALDocArtifact = ($type -eq 'Publish') -or $settings.alDoc.continuousDeployment
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$generateALDocArtifact)"
Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)"

$deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages
$deployToGitHubPages = $settings.alDoc.DeployToGitHubPages
if ($deployToGitHubPages) {
$deployToGitHubPages = IsGitHubPagesAvailable
if (!$deployToGitHubPages) {
Expand Down Expand Up @@ -104,7 +104,7 @@ if (!($environments)) {
"BranchesFromPolicy" = @()
"Projects" = '*'
"SyncMode" = $null
"ContinuousDeployment" = !($getEnvironments -like '* (PROD)' -or $getEnvironments -like '* (Production)' -or $getEnvironments -like '* (FAT)' -or $getEnvironments -like '* (Final Acceptance Test)')
"continuousDeployment" = !($getEnvironments -like '* (PROD)' -or $getEnvironments -like '* (Production)' -or $getEnvironments -like '* (FAT)' -or $getEnvironments -like '* (Final Acceptance Test)')
"runs-on" = @($settings."runs-on".Split(',').Trim())
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@ else {
"BranchesFromPolicy" = @()
"Projects" = '*'
"SyncMode" = $null
"ContinuousDeployment" = $null
"continuousDeployment" = $null
"runs-on" = @($settings."runs-on".Split(',').Trim())
}

Expand Down
22 changes: 11 additions & 11 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ If false, the templateSha repository setting is used to download specific AL-Go
### New Settings

- `alDoc` : JSON object with properties for the ALDoc reference document generation
- **ContinuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false)
- **DeployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actions. (Default true)
- **MaxReleases** = Maximum number of releases to include in the reference documentation. (Default 3)
- **UseProjectsAsFolders** = Determines whether projects in multi-project repositories are used as folders in reference documentation
- **Projects** = An array of projects to include in the reference documentation. (Default all)
- **ExcludeProjects** = An array of projects to exclude in the reference documentation. (Default none)-
- **Header** = Header for the documentation site. (Default: Documentation for...)
- **Footer** = Footer for the documentation site. (Default: Made with...)
- **DefaultIndexMD** = Markdown for the landing page of the documentation site. (Default: Reference documentation...)
- **DefaultReleaseMD** = Markdown for the landing page of the release sites. (Default: Release reference documentation...)
- *Note that in Header, Footer, DefaultIndexMD and DefaultReleaseMD you can use the following placeholders: {REPOSITORY}, {VERSION}, {INDEXTEMPLATERELATIVEPATH}, {RELEASENOTES}*
- **continuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false)
- **deployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actions. (Default true)
- **maxReleases** = Maximum number of releases to include in the reference documentation. (Default 3)
- **useProjectsAsFolders** = Determines whether projects in multi-project repositories are used as folders in reference documentation
- **includeProjects** = An array of projects to include in the reference documentation. (Default all)
- **excludeProjects** = An array of projects to exclude in the reference documentation. (Default none)-
- **header** = Header for the documentation site. (Default: Documentation for...)
- **footer** = Footer for the documentation site. (Default: Made with...)
- **defaultIndexMD** = Markdown for the landing page of the documentation site. (Default: Reference documentation...)
- **defaultReleaseMD** = Markdown for the landing page of the release sites. (Default: Release reference documentation...)
- *Note that in header, footer, defaultIndexMD and defaultReleaseMD you can use the following placeholders: {REPOSITORY}, {VERSION}, {INDEXTEMPLATERELATIVEPATH}, {RELEASENOTES}*

### New Workflows
- **Deploy Reference Documentation** is a workflow, which you can invoke manually or on a schedule to generate and deploy reference documentation using the aldoc tool, using the ALDoc setting properties described above.
Expand Down
Loading

0 comments on commit c95cc03

Please sign in to comment.