A yml method check_changes is presented that can check whether the only commit change to GutHub was the project;’s README file. There is one qualification though. If the project version has changed (Major.Minor) then a new release is always created.

This post follows the previous post on creating a new release when a WPF app is commited to GitHub:
GitHub Actions Release Versioning Guide

This was added at the top of release.yml in teh root the project folder:

   - name: Check for README-only change
      id: check_changes
      shell: pwsh
      run: |
        # For workflow_dispatch we always proceed
        if ('$' -eq 'workflow_dispatch') {
          Write-Host "Triggered by workflow_dispatch - not skipping"
          "skip=false" >> $env:GITHUB_OUTPUT
          exit 0
        }

        $before = '$'
        $after = '$'

        if ($before -eq '0000000000000000000000000000000000000000') {
          Write-Host "Initial commit or branch created - proceeding"
          "skip=false" >> $env:GITHUB_OUTPUT
          exit 0
        }

        $files = git diff --name-only $before $after | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' }
        Write-Host "Changed files:`n$files"

        # If the project csproj itself changed, always proceed with a release
        $csprojPath = 'SwissTimingDisplay/SwissTimingDisplay.csproj'
        if ($files -contains $csprojPath) {
          Write-Host "Project csproj changed in this push - proceeding with release"
          "skip=false" >> $env:GITHUB_OUTPUT
          exit 0
        }

        $readmeOnly = ($files.Count -eq 1 -and ($files[0] -match '^(README\.md|readme\.md)$'))

        # If only the root README changed, normally skip. However, if the project csproj's Version/VersionPrefix
        # changed between commits, force a release. Compare the version in the csproj at $before and current.
        if ($readmeOnly) {
          $csprojPath = 'SwissTimingDisplay/SwissTimingDisplay.csproj'

          # Try to get the csproj content from the previous commit
          $oldContent = $null
          try {
            $oldContent = git show "$before:$csprojPath" 2>$null
          } catch {
            $oldContent = $null
          }

          # Read current csproj content from workspace
          $newContent = $null
          try {
            $newContent = Get-Content $csprojPath -Raw
          } catch {
            $newContent = $null
          }

          $oldVersion = $null
          $newVersion = $null

          if ($oldContent) {
            try {
              [xml]$oldXml = $oldContent
              $oldVersion = $oldXml.Project.PropertyGroup.Version
              if (-not $oldVersion) { $oldVersion = $oldXml.Project.PropertyGroup.VersionPrefix }
            } catch {
              $oldVersion = $null
            }
          }

          if ($newContent) {
            try {
              [xml]$newXml = $newContent
              $newVersion = $newXml.Project.PropertyGroup.Version
              if (-not $newVersion) { $newVersion = $newXml.Project.PropertyGroup.VersionPrefix }
            } catch {
              $newVersion = $null
            }
          }

          Write-Host "Old csproj version: $oldVersion"
          Write-Host "New csproj version: $newVersion"

          if ($oldVersion -and $newVersion -and ($oldVersion -ne $newVersion)) {
            Write-Host "Project version changed between commits - proceeding with release"
            "skip=false" >> $env:GITHUB_OUTPUT
            exit 0
          }

          Write-Host "Only root README changed and project version did not change - skipping release creation and build steps."
          "skip=true" >> $env:GITHUB_OUTPUT
          exit 0
        }

        "skip=false" >> $env:GITHUB_OUTPUT

Then when there needs qualification in the previously existing file, insert the following

 if: steps.check_changes.outputs.skip != 'true'

For example

     run: |
        [xml]$proj = Get-Content "SwissTimingDisplay/SwissTimingDisplay.csproj"

becomes:

if: steps.check_changes.outputs.skip != 'true'
      run: |
        [xml]$proj = Get-Content "SwissTimingDisplay/SwissTimingDisplay.csproj"

 TopicSubtopic
<  Prev:   GitHub
   
 This Category Links 
Category:Web Sites Index:Web Sites