Skip to content

Merge pull request #8 from Get-Nerdio/macos #8

Merge pull request #8 from Get-Nerdio/macos

Merge pull request #8 from Get-Nerdio/macos #8

Workflow file for this run

name: Update markdown files
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'windows/**'
- 'macos/**'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install MarkdownPS
shell: pwsh
run: |
Install-PSResource -Name "MarkdownPS" -TrustRepository -Scope "CurrentUser" -ErrorAction "Stop"
- name: Update POLICIES.md
shell: pwsh
run: |
"$env:GITHUB_WORKSPACE/windows", "$env:GITHUB_WORKSPACE/macos" | ForEach-Object {
$Parent = $_
Get-ChildItem -Path $Parent -Directory | ForEach-Object {
$SubDir = $_
$Content = New-MDHeader -Text $SubDir.Name -Level 1
$Content += "`n"
$Content += Get-ChildItem -Path $SubDir.FullName -Recurse -Include "*.json" | ForEach-Object {
$File = $_
$Props = Get-Content -Path $File.FullName -ErrorAction "SilentlyContinue" | ConvertFrom-Json | Select-Object -Property "name", "displayName", "description"
if ($null -ne $Props.description) {
[PSCustomObject] @{
Name = $(if ($null -eq $Props.name) { $Props.displayName } else { $Props.name })
Description = $Props.description
}
}
} | New-MDTable -Shrink
$Content | Set-Content -Path "$($SubDir.FullName)/README.md"
}
}
- name: Commit changes
id: commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Update POLICIES.md"
commit_user_name: "github-actions"
commit_user_email: "github-actions@users.noreply.github.com"