Skip to content

Commit 0550f80

Browse files
authored
Merge pull request #414 from Hau-Hau/add-logs
add logs to has-changes action, run auto-complete-pr every 6 hours
2 parents 2a7ab07 + 9cfcace commit 0550f80

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

.github/actions/has-changes/action.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,26 @@ runs:
5656
param ($CsprojPath, $CurrentHash, $PrevHash)
5757
5858
$projectDirectoryPath = "$(Split-Path -Path $CsprojPath)"
59+
Write-Host "Checking changes in: $projectDirectoryPath"
5960
$output = $(git diff --quiet "$($CurrentHash):$($projectDirectoryPath -replace '\\', '/')" "$($PrevHash):$($projectDirectoryPath -replace '\\', '/')" -- ':!*.nuspec'; $LASTEXITCODE -ne 0)
6061
6162
if ($output) {
63+
Write-Host " -> Direct changes detected in $projectDirectoryPath"
6264
return $output;
6365
}
6466
6567
$csproj = [xml](Get-Content "$($CsprojPath)")
6668
$projectReferences = $csproj.Project.ItemGroup.ProjectReference | Where-Object { $_ -ne $null }
69+
Write-Host " -> Checking $($projectReferences.Count) project references"
6770
foreach ($projectReference in $projectReferences) {
6871
if (-not([string]::IsNullOrWhitespace($projectReference.IncludeAssets)) -and $projectReference.IncludeAssets -ne "All") {
72+
Write-Host " -> Skipping reference (IncludeAssets != All): $($projectReference.Include)"
6973
continue;
7074
}
7175
72-
$output = HasChanges -CsprojPath "$(Resolve-RelativePath $([IO.Path]::Combine($projectDirectoryPath, $projectReference.Include)))" -CurrentHash $CurrentHash -PrevHash $PrevHash
76+
$refPath = "$(Resolve-RelativePath $([IO.Path]::Combine($projectDirectoryPath, $projectReference.Include)))"
77+
Write-Host " -> Checking reference: $refPath"
78+
$output = HasChanges -CsprojPath $refPath -CurrentHash $CurrentHash -PrevHash $PrevHash
7379
if ($output) {
7480
break;
7581
}
@@ -79,30 +85,39 @@ runs:
7985
}
8086
8187
$SelectedProject = "${{ inputs.project }}"
88+
Write-Host "Checking project: $SelectedProject"
8289
8390
$currentHash = git rev-parse HEAD
8491
if (-not $currentHash) {
8592
Write-Host "Cannot fetch hash of HEAD"
8693
exit 1
8794
}
95+
Write-Host "Current hash: $currentHash"
8896
8997
# Fetch hash of last release based on the project input
9098
$lastReleaseHash = git tag -l "$($SelectedProject)/*" | Sort-Object { [version]($_ -split '/' | Select-Object -Last 1) } | Select-Object -Last 1 | ForEach-Object { git rev-list -n 1 $_ }
9199
if (-not $lastReleaseHash) {
92100
Write-Host "Cannot fetch hash of last release"
93101
exit 1
94102
}
103+
Write-Host "Last release hash: $lastReleaseHash"
95104
96105
$csProjPath = "$([IO.Path]::Combine(".", "$($SelectedProject)", "$($SelectedProject).csproj"))"
106+
Write-Host "Starting change detection for: $csProjPath"
97107
$hasDifferences = HasChanges -CsprojPath $csProjPath -CurrentHash $currentHash -PrevHash $lastReleaseHash
108+
98109
if ($hasDifferences) {
110+
Write-Host "Changes detected, checking nuspec..."
99111
$nuspecPath = "$([IO.Path]::Combine(".", "$($SelectedProject)", "$($SelectedProject).nuspec"))"
100112
[xml]$nuspec = Get-Content $nuspecPath
101113
$hashFromNuspec = $nuspec.package.metadata.repository.commit
102114
if ($hashFromNuspec) {
115+
Write-Host "Nuspec commit hash found: $hashFromNuspec - rechecking against this hash"
103116
$hasDifferences = HasChanges -CsprojPath $csProjPath -CurrentHash $currentHash -PrevHash $hashFromNuspec
104117
}
105118
}
106119
120+
Write-Host "Final result: $hasDifferences"
107121
"result=$("$($hasDifferences)".ToLowerInvariant())" >> $env:GITHUB_OUTPUT
108122
exit 0
123+

.github/workflows/auto-complete-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Auto-Complete PR
22

33
on:
44
schedule:
5-
# Run every 3 hours
6-
- cron: '0 */3 * * *'
5+
# Run every 6 hours
6+
- cron: '0 */6 * * *'
77
workflow_dispatch:
88

99
permissions:

0 commit comments

Comments
 (0)