Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/Shared-StaleBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ jobs:
AheadBy = $AheadBy
BehindBy = $BehindBy
DaysSinceLastCommit = $($(Get-Date) - $LastCommitDate).Days
DaysSinceLastCommitOnDeleteDay = $($DeletionDate - $LastCommitDate).Days
ProcessingResult = $Null
BranchCreator = $BranchCreator
}
Expand Down Expand Up @@ -452,8 +453,8 @@ jobs:
# Branch processing has completed and, from this point on, reporting is generated.

# Construct the markdown table header that'll be used in the workflow summary.
$TableHeaderRow1 = "| Branch name | Branch creator | Commits ahead by | Commits behind by | Days since last commit | Processing result |"
$TableHeaderRow2 = "|-------------|----------------|------------------|-------------------|------------------------|-------------------|"
$TableHeaderRow1 = "| Branch name | Branch creator | Commits ahead by | Commits behind by | Days since last commit<br>(on $FriendlyDeletionDate) | Processing result |"
$TableHeaderRow2 = "|-------------|----------------|:----------------:|:-----------------:|:----------------------------------------------------:|-------------------|"

# Set job summary and create the "Deleted stale branches" section.
echo "# Stale branch results" >> $env:GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -507,6 +508,10 @@ jobs:

echo "The following branches will be deleted on **$FriendlyDeletionDate** because they will be over $MaxDaysBehind days behind the $DefaultBranch branch on that date. They also contain $MaxCommitsAhead or fewer commits not in the $DefaultBranch branch." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "**Days since last commit** shows two values:" >> $env:GITHUB_STEP_SUMMARY
echo "- The number of days between the most recent commit and the date the workflow runs." >> $env:GITHUB_STEP_SUMMARY
echo "- The projected number of days between the most recent commit and the scheduled branch-deletion date, $FriendlyDeletionDate, shown in parentheses." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "> [!IMPORTANT]" >> $env:GITHUB_STEP_SUMMARY
echo "> **If you don't want a branch to be deleted, merge $DefaultBranch into it before $FriendlyDeletionDate.**" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
Expand All @@ -527,11 +532,12 @@ jobs:
$AB = $BranchReport.AheadBy
$BB = $BranchReport.BehindBy
$LC = $BranchReport.DaysSinceLastCommit
$DD = $BranchReport.DaysSinceLastCommitOnDeleteDay
$PR = $BranchReport.ProcessingResult
$BC = $BranchReport.BranchCreator

Write-Host "$PR`: Branch name: $BN. Branch creator: $BC. Ahead by: $AB. Behind by: $BB. Days since last commit: $LC. "
echo "| $BN | [$BC]($GitHubBaseUrl/$BC) | $AB | $BB | $LC | $PR |" >> $env:GITHUB_STEP_SUMMARY
Write-Host "$PR`: Branch name: $BN. Branch creator: $BC. Ahead by: $AB. Behind by: $BB. Days since last commit: $LC. On $FriendlyDeletionDate`: ($DD)."
echo "| $BN | [$BC]($GitHubBaseUrl/$BC) | $AB | $BB | $LC<br>($DD) | $PR |" >> $env:GITHUB_STEP_SUMMARY

}

Expand Down Expand Up @@ -565,13 +571,14 @@ jobs:
$AB = $BranchReport.AheadBy
$BB = $BranchReport.BehindBy
$LC = $BranchReport.DaysSinceLastCommit
$DD = $BranchReport.DaysSinceLastCommitOnDeleteDay
$PR = $BranchReport.ProcessingResult
$BC = $BranchReport.BranchCreator

$BranchDiffHtmlUrl = "$($GitHubData.event.repository.html_url)/compare/$DefaultBranch...$($BN)#files_bucket"

Write-Host "$PR`: Branch name: $BN. Branch creator: $BC. Ahead by: $AB. Behind by: $BB. Days since last commit: $LC. "
echo "| [$BN]($BranchDiffHtmlUrl) | [$BC]($GitHubBaseUrl/$BC) | $AB | $BB | $LC | $PR |" >> $env:GITHUB_STEP_SUMMARY
Write-Host "$PR`: Branch name: $BN. Branch creator: $BC. Ahead by: $AB. Behind by: $BB. Days since last commit: $LC. On $FriendlyDeletionDate`: ($DD)."
echo "| [$BN]($BranchDiffHtmlUrl) | [$BC]($GitHubBaseUrl/$BC) | $AB | $BB | $LC<br>($DD) | $PR |" >> $env:GITHUB_STEP_SUMMARY

}

Expand Down