From 0d7342ab35d8f798ed58e5798aefa35b3f768366 Mon Sep 17 00:00:00 2001 From: Trent Blackburn Date: Wed, 6 May 2026 18:57:45 -0400 Subject: [PATCH] chore: pin line endings to LF via .gitattributes Windows clones with global core.autocrlf=true rewrite the working tree to CRLF on checkout. Subsequent edits made through tooling that writes LF (most editors and AI agents do) trigger 'LF will be replaced by CRLF the next time Git touches it' warnings on every commit. Pinning eol=lf in .gitattributes overrides the contributor's global autocrlf setting for this repo and silences the warning. PowerShell on Windows handles LF fine. Renormalize touches 1 file with mixed line endings; content unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitattributes | 6 + .../PublishModuleToPowerShellGallery.yaml | 164 +++++++++--------- 2 files changed, 88 insertions(+), 82 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..18e3158 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Normalize line endings to LF in both the repo and the working tree, regardless of +# the contributor's global core.autocrlf setting. PowerShell on Windows handles LF +# fine. Without this, Windows clones with core.autocrlf=true emit "LF will be +# replaced by CRLF the next time Git touches it" warnings on every commit when +# files are edited by tooling that writes LF (most editors and AI agents do). +* text=auto eol=lf diff --git a/.github/workflows/PublishModuleToPowerShellGallery.yaml b/.github/workflows/PublishModuleToPowerShellGallery.yaml index 7217102..ebe5fcd 100644 --- a/.github/workflows/PublishModuleToPowerShellGallery.yaml +++ b/.github/workflows/PublishModuleToPowerShellGallery.yaml @@ -1,82 +1,82 @@ -name: Publish Module to PowerShell Gallery - -on: - push: - branches: - - main - paths: - - 'ReScenePS/ReScenePS.psd1' - workflow_dispatch: - -permissions: - contents: write - -jobs: - publish: - name: Publish Module - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Get Module Version - id: version - shell: pwsh - run: | - $manifest = Import-PowerShellDataFile -Path ./ReScenePS/ReScenePS.psd1 - $version = $manifest.ModuleVersion - Write-Host "Module version: $version" - "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - - - name: Check if Release Exists - id: check_release - shell: bash - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if gh release view "v${{ steps.version.outputs.version }}" > /dev/null 2>&1; then - echo "exists=true" >> $GITHUB_OUTPUT - echo "GitHub release v${{ steps.version.outputs.version }} already exists" - else - echo "exists=false" >> $GITHUB_OUTPUT - echo "GitHub release v${{ steps.version.outputs.version }} does not exist" - fi - - - name: Check if PSGallery Version Exists - id: check_psgallery - if: steps.check_release.outputs.exists == 'false' - shell: pwsh - run: | - $version = "${{ steps.version.outputs.version }}" - $published = Find-Module -Name ReScenePS -RequiredVersion $version -Repository PSGallery -ErrorAction SilentlyContinue - if ($published) { - Write-Host "PSGallery version $version already exists" - "exists=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - } else { - Write-Host "PSGallery version $version not found - will publish" - "exists=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - } - - - name: Bootstrap - if: steps.check_release.outputs.exists == 'false' - shell: pwsh - run: ./build.ps1 -Task Init -Bootstrap - - - name: Create GitHub Release - if: steps.check_release.outputs.exists == 'false' - shell: bash - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "v${{ steps.version.outputs.version }}" \ - --title "v${{ steps.version.outputs.version }}" \ - --generate-notes - - - name: Publish to PSGallery - if: steps.check_release.outputs.exists == 'false' && steps.check_psgallery.outputs.exists == 'false' - shell: pwsh - env: - PSGALLERY_API_KEY: ${{ secrets.PS_GALLERY_KEY }} - run: ./build.ps1 -Task Publish -Bootstrap +name: Publish Module to PowerShell Gallery + +on: + push: + branches: + - main + paths: + - 'ReScenePS/ReScenePS.psd1' + workflow_dispatch: + +permissions: + contents: write + +jobs: + publish: + name: Publish Module + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Get Module Version + id: version + shell: pwsh + run: | + $manifest = Import-PowerShellDataFile -Path ./ReScenePS/ReScenePS.psd1 + $version = $manifest.ModuleVersion + Write-Host "Module version: $version" + "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + + - name: Check if Release Exists + id: check_release + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if gh release view "v${{ steps.version.outputs.version }}" > /dev/null 2>&1; then + echo "exists=true" >> $GITHUB_OUTPUT + echo "GitHub release v${{ steps.version.outputs.version }} already exists" + else + echo "exists=false" >> $GITHUB_OUTPUT + echo "GitHub release v${{ steps.version.outputs.version }} does not exist" + fi + + - name: Check if PSGallery Version Exists + id: check_psgallery + if: steps.check_release.outputs.exists == 'false' + shell: pwsh + run: | + $version = "${{ steps.version.outputs.version }}" + $published = Find-Module -Name ReScenePS -RequiredVersion $version -Repository PSGallery -ErrorAction SilentlyContinue + if ($published) { + Write-Host "PSGallery version $version already exists" + "exists=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } else { + Write-Host "PSGallery version $version not found - will publish" + "exists=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } + + - name: Bootstrap + if: steps.check_release.outputs.exists == 'false' + shell: pwsh + run: ./build.ps1 -Task Init -Bootstrap + + - name: Create GitHub Release + if: steps.check_release.outputs.exists == 'false' + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "v${{ steps.version.outputs.version }}" \ + --title "v${{ steps.version.outputs.version }}" \ + --generate-notes + + - name: Publish to PSGallery + if: steps.check_release.outputs.exists == 'false' && steps.check_psgallery.outputs.exists == 'false' + shell: pwsh + env: + PSGALLERY_API_KEY: ${{ secrets.PS_GALLERY_KEY }} + run: ./build.ps1 -Task Publish -Bootstrap