Skip to content

Commit a9d2dd6

Browse files
committed
Update script
1 parent 7346aa2 commit a9d2dd6

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

github/github-license.ps1

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
param (
88
[string] [Parameter(Mandatory=$false)] $csvPath = "C:\Users\audun\Downloads\ghas_active_committers_miljodir_2025-01-31T0015.csv",
99
[string] [Parameter(Mandatory=$false)] $csvPath2 = "C:\Users\audun\Downloads\export-miljodir-1738311321.csv",
10-
[string] [Parameter(Mandatory=$false)] $copilotCsvPath = "C:\Users\audun\Downloads\miljodir-seat-usage-1738311386.csv"
10+
[string] [Parameter(Mandatory=$false)] $copilotCsvPath = "C:\Users\audun\Downloads\miljodir-seat-usage-1738311386.csv",
11+
[string] [Parameter(Mandatory=$false)] $workspaceId = "xxxx"
12+
1113
)
1214

1315
$csv = import-csv -Path $csvPath
@@ -34,13 +36,6 @@ $copilotUsedByOtherOrgsOnly = $copilotCsv | Where-Object { -not ($userLogins -co
3436
# Output users which are using copilot but seemingly not pushing code to the org
3537
$copilotUsedByOtherOrgsOnly
3638

37-
# Output the missing entries
38-
Write-Host "Found $($nonPushingMembers.Count) members which have not pushed code in the last 3 months."
39-
$nonPushingMembers | select "GitHub com login", "GitHub com saml name", "Github com name"
40-
# Output the result
41-
#Write-Host "$($latestPerUser.Count) users found commiting code in the last 3 months."
42-
#$latestPerUser | Select-Object 'User login', 'Organization / repository', 'Last pushed date', 'Last pushed email' | Sort-Object 'Last pushed date' | Format-Table -AutoSize
43-
4439
# Successful Github Logins
4540
$githubLoginQuery = @"
4641
SigninLogs
@@ -52,15 +47,20 @@ SigninLogs
5247
| project UserPrincipalName
5348
"@
5449

55-
# Define the workspace and resource group
56-
$workspaceId = "xxx"
57-
5850
# Execute the query
51+
$allGithubUsers = $usersCsv | select -ExpandProperty "GitHub com saml name"
5952
$githubLoginsList = (Invoke-AzOperationalInsightsQuery -WorkspaceId $workspaceId -Query $githubLoginQuery).Results | Select-Object -ExpandProperty UserPrincipalName
60-
$nonPushingNamesList = $nonPushingMembers | Select-Object -ExpandProperty 'GitHub com saml name'
6153

62-
$missingNames = $nonPushingNamesList | Where-Object { -not ($githubLoginsList -contains $_) }
54+
$missingNames = $allGithubUsers | Where-Object { -not ($githubLoginsList -contains $_) }
6355

6456
# Output the missing names
65-
Write-Host "The following names have not signed in to Github for at least the past 5 months" -ForegroundColor Red
66-
$missingNames | ForEach-Object { Write-Host $_ }
57+
Write-Host "The following names have not signed in to the Github org for at least the past 5 months" -ForegroundColor Red
58+
Write-Host "Note that some users may have signed in to other orgs under the enterprise, and are still requiring a license." -ForegroundColor Yellow
59+
$missingNames | ForEach-Object { Write-Host $_ }
60+
61+
# Output the missing entries
62+
Write-Host "Found $($nonPushingMembers.Count) members which have not pushed code in the last 3 months."
63+
$nonPushingMembers | select "GitHub com login", "GitHub com saml name", "Github com name"
64+
# Output the result
65+
Write-Host "$($latestPerUser.Count) users found commiting code in the last 3 months."
66+
$latestPerUser | Select-Object 'User login', 'Organization / repository', 'Last pushed date', 'Last pushed email' | Sort-Object 'Last pushed date' | Format-Table -AutoSize

0 commit comments

Comments
 (0)