@@ -11,6 +11,7 @@ namespace DotNetNuke.Build.Tasks
1111 using System . Net . Http . Headers ;
1212 using System . Security . Cryptography ;
1313 using System . Text ;
14+ using System . Text . RegularExpressions ;
1415
1516 using Cake . Common ;
1617 using Cake . Common . Diagnostics ;
@@ -47,6 +48,7 @@ public sealed class CreateGitHubPullRequest : FrostingTask<Context>
4748 {
4849 private const string TargetBranch = "develop" ;
4950 private const string BugReportPath = ".github/ISSUE_TEMPLATE/bug-report.yml" ;
51+ private const string SolutionInfoPath = "SolutionInfo.cs" ;
5052 private const string GitUserName = "DNN Platform CI Bot" ;
5153 private const string GitUserEmail = "noreply@dnncommunity.org" ;
5254
@@ -101,6 +103,10 @@ public override void Run(Context context)
101103 // Update bug-report.yml with version info from GitHub releases
102104 UpdateBugReportVersions ( context , client , owner , repo ) ;
103105
106+ // Reset SolutionInfo.cs if only the commit count/SHA changed (not the major.minor.patch)
107+ // to avoid creating a PR for every single commit.
108+ ResetSolutionInfoIfVersionUnchanged ( context ) ;
109+
104110 // Only proceed with the PR if there are actual changes
105111 if ( ! HasUncommittedChanges ( context ) )
106112 {
@@ -377,6 +383,48 @@ private static bool HasUncommittedChanges(ICakeContext context)
377383 return output . Count > 0 ;
378384 }
379385
386+ private static void ResetSolutionInfoIfVersionUnchanged ( Context context )
387+ {
388+ var committedProcess = context . StartAndReturnProcess (
389+ "git" ,
390+ new ProcessSettings
391+ {
392+ Arguments = $ "show HEAD:{ SolutionInfoPath } ",
393+ RedirectStandardOutput = true ,
394+ } ) ;
395+ committedProcess . WaitForExit ( ) ;
396+
397+ if ( committedProcess . GetExitCode ( ) != 0 )
398+ {
399+ context . Information ( "Could not read committed {0}, skipping reset check." , SolutionInfoPath ) ;
400+ return ;
401+ }
402+
403+ var committedContent = string . Join ( "\n " , committedProcess . GetStandardOutput ( ) ) ;
404+ var currentContent = File . ReadAllText ( SolutionInfoPath ) ;
405+
406+ var committedVersion = ExtractAssemblyVersion ( committedContent ) ;
407+ var currentVersion = ExtractAssemblyVersion ( currentContent ) ;
408+
409+ context . Information ( "SolutionInfo.cs AssemblyVersion — committed: '{0}', current: '{1}'." , committedVersion , currentVersion ) ;
410+
411+ if ( string . Equals ( committedVersion , currentVersion , StringComparison . Ordinal ) )
412+ {
413+ context . Information ( "Major.Minor.Patch has not changed. Resetting {0} to avoid a noisy PR." , SolutionInfoPath ) ;
414+ Git ( context , $ "checkout -- { SolutionInfoPath } ") ;
415+ }
416+ else
417+ {
418+ context . Information ( "Major.Minor.Patch changed ({0} → {1}). Keeping {2} modifications." , committedVersion , currentVersion , SolutionInfoPath ) ;
419+ }
420+ }
421+
422+ private static string ExtractAssemblyVersion ( string content )
423+ {
424+ var match = Regex . Match ( content , @"\[assembly:\s*AssemblyVersion\(""([^""]+)""\)\]" ) ;
425+ return match . Success ? match . Groups [ 1 ] . Value : string . Empty ;
426+ }
427+
380428 private static void Git ( ICakeContext context , string arguments , bool redactOutput = false )
381429 {
382430 context . Information ( "git {0}" , redactOutput ? "[redacted]" : arguments ) ;
0 commit comments