Skip to content

Commit

Permalink
handle null created date (#1393)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradystroud authored Jul 8, 2024
1 parent 32c3e9b commit 5b4b831
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions build-scripts/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$createdRecord = cd ../../SSW.Rules.Content && git log --diff-filter=A --reverse --pretty="%ad<LINE>%aN<LINE>%ae" --date=iso-strict -- rules/conduct-a-test-please/rule.md
$createdDetails = $createdRecord -split "<LINE>"

$historyFileArray = @{
file = 'test'
created = $createdDetails[0] ?? $lastUpdated
createdBy = $createdDetails[1]
createdByEmail = $createdDetails[2]
}

echo $historyFileArray
8 changes: 4 additions & 4 deletions build-scripts/update-rule-history.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $historyArray | Foreach-Object {
$fileArray | Where-Object {$_ -Match "^*.md" } | Foreach-Object {
if(!$filesProcessed.ContainsKey($_))
{
$createdRecord = git log --diff-filter=A --reverse --pretty="%ad<LINE>%aN<LINE>%ae" --date=iso-strict -- $_
$createdRecord = git log --diff-filter=A --reverse --pretty="%ad<LINE>%aN<LINE>%ae<LINE>" --date=iso-strict -- $_
$createdDetails = $createdRecord -split "<LINE>"

$filesProcessed.Add($_, 0)
Expand All @@ -65,9 +65,9 @@ $historyArray | Foreach-Object {
lastUpdated = $lastUpdated
lastUpdatedBy = $lastUpdatedBy
lastUpdatedByEmail = $lastUpdatedByEmail
created = $createdDetails[0]
createdBy = $createdDetails[1]
createdByEmail = $createdDetails[2]
created = $createdDetails[0] ?? $lastUpdated
createdBy = $createdDetails[1] ?? $lastUpdatedBy
createdByEmail = $createdDetails[2] ?? $lastUpdatedByEmail
}

echo $_
Expand Down

0 comments on commit 5b4b831

Please sign in to comment.