|
17 | 17 | [int]
|
18 | 18 | $DaysBack = 28
|
19 | 19 | )
|
20 |
| - |
21 | 20 | $SinceDate = (Get-Date).AddDays((0-$DaysBack))
|
22 | 21 | $SinceDateStr = $SinceDate.ToString('yyyy-MM-ddTHH:mm:ssZ')
|
23 | 22 | $Branch = git branch --show-current # The Git 2.22 and above support.
|
@@ -74,28 +73,43 @@ $sortPRs = $validPRs | Sort-Object -Property @{Expression = {$_.author.login}; D
|
74 | 73 |
|
75 | 74 | $skipContributors = @('aladdindoc')
|
76 | 75 |
|
77 |
| -$contributorsMDHeaderFlag = $True |
| 76 | +# Get team members of the azure-powershell-team. |
| 77 | +$teamMembers = (Invoke-WebRequest -Uri "https://api.github.com/orgs/Azure/teams/azure-powershell-team/members" -Authentication Bearer -Token $token).Content | ConvertFrom-Json |
| 78 | + |
| 79 | +foreach ($members in $teamMembers) { |
| 80 | + $skipContributors += $members.login |
| 81 | +} |
| 82 | + |
| 83 | +# Output external contributors information. |
| 84 | +Write-Debug 'Output external contributors information.' |
| 85 | +'### Thanks to our community contributors' | Out-File -FilePath $contributorsMDFile -Force |
| 86 | +Write-Host '### Thanks to our community contributors' |
| 87 | + |
78 | 88 | for ($PR = 0; $PR -lt $sortPRs.Length; $PR++) {
|
79 |
| - if ($skipContributors.Contains($sortPRs[$PR].author.login)) |
| 89 | + |
| 90 | + $account = $sortPRs[$PR].author.login |
| 91 | + $name = $sortPRs[$PR].commit.author.name |
| 92 | + $index = $sortPRs[$PR].commit.message.IndexOf("`n`n") |
| 93 | + |
| 94 | + if ($skipContributors.Contains($account)) |
80 | 95 | {
|
81 | 96 | continue
|
82 | 97 | }
|
| 98 | + |
| 99 | + # Skip if commit author exists in skipContributors list. |
| 100 | + if ([System.String]::IsNullOrEmpty($account) -and $skipContributors.Contains($name)) |
| 101 | + { |
| 102 | + continue |
| 103 | + } |
| 104 | + |
83 | 105 | # Check whether the contributor belongs to the Azure organization.
|
84 | 106 | Invoke-RestMethod -Uri "https://api.github.com/orgs/Azure/members/$($sortPRs[$PR].author.login)" -Authentication Bearer -Token $token -ResponseHeadersVariable 'ResponseHeaders' -StatusCodeVariable 'StatusCode' -SkipHttpErrorCheck > $null
|
85 | 107 | if ($StatusCode -eq '204') {
|
86 | 108 | # Add internal contributors to skipContributors to reduce the number of https requests sent.
|
87 | 109 | $skipContributors += $sortPRs[$PR].author.login
|
88 | 110 | continue
|
89 | 111 | }
|
90 |
| - if ($contributorsMDHeaderFlag) { |
91 |
| - Write-Debug 'Output exteneral contributors infomation.' |
92 |
| - '### Thanks to our community contributors' | Out-File -FilePath $contributorsMDFile -Force |
93 |
| - Write-Host '### Thanks to our community contributors' |
94 |
| - $contributorsMDHeaderFlag = $False |
95 |
| - } |
96 |
| - $account = $sortPRs[$PR].author.login |
97 |
| - $name = $sortPRs[$PR].commit.author.name |
98 |
| - $index = $sortPRs[$PR].commit.message.IndexOf("`n`n") |
| 112 | + |
99 | 113 | if ($index -lt 0) {
|
100 | 114 | $commitMessage = $sortPRs[$PR].commit.message
|
101 | 115 | } else {
|
|
0 commit comments