Skip to content

using out-string

using out-string #15

name: copy-documentation-readme-upwards
on:
push:
branches:
- main
- dev/upm-readiness
jobs:
copy-documentation-readme-upwards:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: copy documentation readme upwards
run: |
git config user.name github-actions
git config user.email [email protected]
$readmeDir = Get-Item -Path "**/Packages/com.*/Documentation~" | Select-Object -ExpandProperty FullName
$readmeDir = $readmeDir.replace('${{ github.workspace }}/','')
echo $readmeDir
$readmeContent = gc (Get-Item -Path "**/Packages/com.*/Documentation~/README.md") -Raw
$readmeContent = $readmeContent -replace '(\[.*\])\(((?!https?:\/\/).+)\)',('$1('+$readmeDir+'/$2)')
echo $readmeContent
echo "v.s."
Set-Content README.md $readmeContent
$targetContent = gc README.md -Raw
echo $targetContent
if (-not Compare-Object ($readmeContent | out-string) ($targetContent | out-string)) {echo "eq"} else {echo "ne"}
# Set-Content ./README.md $readmeContent
# git add ./README.md
# git commit -m 'Copied repo README from package README'
working-directory: ${{ github.workspace }}
shell: pwsh