Nightly Job #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Job | |
on: | |
schedule: | |
# weekly at 7am on Mondays | |
- cron: '0 7 * * 1' | |
workflow_dispatch: | |
jobs: | |
processRepos: | |
name: Process Linux repos | |
env: | |
user: samsmithnz | |
strategy: | |
matrix: | |
repo: ['samsmithnz/AzurePipelinesToGitHubActionsConverter','samsmithnz/AzurePipelinesToGitHubActionsConverterWeb','samsmithnz/CustomQueue','samsmithnz/Dependabot-Configuration-Builder','samsmithnz/DotNetCensus','samsmithnz/DSPTree','samsmithnz/FactorySim','samsmithnz/GitHubActionsDotNet','samsmithnz/MermaidDotNet','samsmithnz/RepoAutomation','samsmithnz/RepoAutomationUnitTests','samsmithnz/RepoGovernance','samsmithnz/SamsFeatureFlags','samsmithnz/SatisfactoryTree','samsmithnz/SamsDotNetSonarCloudAction','samsmithnz/TurnBasedEngine','SamSmithNZ-dotcom/SamSmithNZ.com','SamSmithNZ-dotcom/MandMCounter','DeveloperMetrics/DevOpsMetrics','DeveloperMetrics/deployment-frequency','DeveloperMetrics/lead-time-for-changes'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ matrix.repo }} | |
token: ${{ secrets.PAT_TOKEN }} | |
path: newRepo | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Scan for NuGet packages needing action | |
continue-on-error: true | |
shell: pwsh | |
run: | | |
if (Test-Path newRepo/src/*.sln -PathType Leaf) | |
{ | |
cd newRepo/src | |
dotnet restore | |
#ls | |
$resultDeprecated = dotnet list package --deprecated --format json | |
if ($resultDeprecated.length -gt 40000) | |
{ | |
write-host "Deprecated result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$deprecatedCount = 0 | |
foreach ($project in ($resultDeprecated | ConvertFrom-Json).projects) | |
{ | |
# write-host "Scanning project" | |
# write-host $project | |
# write-host $project.frameworks | |
# write-host $project.frameworks.Count | |
$deprecatedCount += $project.frameworks.Count | |
} | |
$resultDeprecated | |
#write-host "Deprecated projects found: $($resultDeprecated.projects.Count)" | |
write-host "Deprecated results found: $deprecatedCount" | |
} | |
$resultOutDated = dotnet list package --outdated --format json | |
if ($resultOutDated.length -gt 40000) | |
{ | |
write-host "Outdated result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$outdatedCount = 0 | |
foreach ($project in ($resultOutdated | ConvertFrom-Json).projects) | |
{ | |
$outdatedCount += $project.frameworks.Count | |
} | |
write-host "Outdated results found: $outdatedCount" | |
} | |
$resultVulnerable = dotnet list package --vulnerable --format json | |
if ($resultVulnerable.length -gt 40000) | |
{ | |
write-host "Vulnerable result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$vulnerableCount = 0 | |
foreach ($project in ($resultVulnerable | ConvertFrom-Json).projects) | |
{ | |
$vulnerableCount += $project.frameworks.Count | |
} | |
write-host "Vulnerable results found: $vulnerableCount" | |
} | |
$user = "${{ env.user }}" | |
$owner = "${{ matrix.repo }}".split('/')[0] | |
$repo = "${{ matrix.repo }}".split('/')[1] | |
#Deprecated packages | |
$NuGetDeprecatedPayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultDeprecated | |
PayloadType = "Deprecated" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetDeprecatedPayload | |
#Outdated packages | |
$NuGetOutdatedPayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultOutDated | |
PayloadType = "Outdated" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetOutdatedPayload | |
#Vulnerable packages | |
$NuGetVulnerablePayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultVulnerable | |
PayloadType = "Vulnerable" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetVulnerablePayload | |
} | |
else | |
{ | |
write-host "No .NET solution found" | |
#write-error "No .NET solution found" | |
} | |
processWindowsRepos: | |
name: Process Windows repos | |
env: | |
user: samsmithnz | |
strategy: | |
matrix: | |
repo: ['samsmithnz/PuzzleSolver','samsmithnz/ResearchTree','samsmithnz/Sams2048'] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ matrix.repo }} | |
token: ${{ secrets.PAT_TOKEN }} | |
path: newRepo | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Scan for NuGet packages needing action | |
shell: pwsh | |
run: | | |
if (Test-Path newRepo/src/*.sln -PathType Leaf) | |
{ | |
cd newRepo/src | |
dotnet restore | |
#ls | |
$resultDeprecated = dotnet list package --deprecated --format json | |
if ($resultDeprecated.length -gt 40000) | |
{ | |
write-host "Deprecated result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$deprecatedCount = 0 | |
foreach ($project in ($resultDeprecated | ConvertFrom-Json).projects) | |
{ | |
# write-host "Scanning project" | |
# write-host $project | |
# write-host $project.frameworks | |
# write-host $project.frameworks.Count | |
$deprecatedCount += $project.frameworks.Count | |
} | |
$resultDeprecated | |
#write-host "Deprecated projects found: $($resultDeprecated.projects.Count)" | |
write-host "Deprecated results found: $deprecatedCount" | |
} | |
$resultOutDated = dotnet list package --outdated --format json | |
if ($resultOutDated.length -gt 40000) | |
{ | |
write-host "Outdated result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$outdatedCount = 0 | |
foreach ($project in ($resultOutdated | ConvertFrom-Json).projects) | |
{ | |
$outdatedCount += $project.frameworks.Count | |
} | |
write-host "Outdated results found: $outdatedCount" | |
} | |
$resultVulnerable = dotnet list package --vulnerable --format json | |
if ($resultVulnerable.length -gt 40000) | |
{ | |
write-host "Vulnerable result is too large to be assigned to an environment variable." | |
} | |
else | |
{ | |
$vulnerableCount = 0 | |
foreach ($project in ($resultVulnerable | ConvertFrom-Json).projects) | |
{ | |
$vulnerableCount += $project.frameworks.Count | |
} | |
write-host "Vulnerable results found: $vulnerableCount" | |
} | |
$user = "${{ env.user }}" | |
$owner = "${{ matrix.repo }}".split('/')[0] | |
$repo = "${{ matrix.repo }}".split('/')[1] | |
#Deprecated packages | |
$NuGetDeprecatedPayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultDeprecated | |
PayloadType = "Deprecated" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetDeprecatedPayload | |
#Outdated packages | |
$NuGetOutdatedPayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultOutDated | |
PayloadType = "Outdated" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetOutdatedPayload | |
#Vulnerable packages | |
$NuGetVulnerablePayload = @{ | |
User = $user | |
Owner = $owner | |
Repo = $repo | |
JsonPayload = $resultVulnerable | |
PayloadType = "Vulnerable" | |
} | ConvertTo-Json -Depth 5 | |
Invoke-WebRequest -Uri https://repogovernance-prod-eu-service.azurewebsites.net/api/SummaryItems/UpdateSummaryItemNuGetPackageStats -ContentType "application/json" -Method POST -Body $NuGetVulnerablePayload | |
} | |
else | |
{ | |
write-host "No .NET solution found" | |
#write-error "No .NET solution found" | |
} |