@@ -143,9 +143,8 @@ public async Task ValidateTeam(IssuesEvent issuesEvent, bool createPullRequest)
143143 {
144144 try
145145 {
146- // Check if the member exists
147- await gitHubClient . User . Get ( member ) ;
148- //await gitHubClient.Organization.Member.GetOrganizationMembership(teamRequest.TeamOwner, member);
146+ // Check if the member exists within the organization
147+ await gitHubClient . Organization . Member . GetOrganizationMembership ( teamRequest . TeamOwner , member ) ;
149148 }
150149 catch ( NotFoundException )
151150 {
@@ -257,42 +256,30 @@ public async Task SaveTeam(PullRequestEvent pullRequestEvent)
257256 try
258257 {
259258 var fileContents = await gitHubClient . GetCommitFilesWithContentAsync ( owner ! , repo ! , mergeCommitSha ! ) ;
260- var isComplete = true ;
261- var completeMessage = string . Empty ;
259+ var completeMessage = $ "{ _localizationService . GetLocalizedString ( Constants . ERROR_PR_NO_CHANGES ) } ";
262260
263- if ( fileContents . Count == 0 )
261+ foreach ( var file in fileContents )
264262 {
265- isComplete = false ;
266- completeMessage = $ "{ _localizationService . GetLocalizedString ( Constants . ERROR_PR_NO_CHANGES ) } ";
267- }
268- else
269- {
270- foreach ( var file in fileContents )
263+ if ( file . Key . EndsWith ( DevExPolicies . Team_Metadata . GetPolicyYamlFileName ( ) , StringComparison . OrdinalIgnoreCase ) )
271264 {
272- if ( file . Key . EndsWith ( DevExPolicies . Team_Metadata . GetPolicyYamlFileName ( ) , StringComparison . OrdinalIgnoreCase ) )
273- {
274- var teamMetadata = TeamRequestModel . DeserializeFromYaml ( file . Value ) ;
265+ var teamMetadata = TeamRequestModel . DeserializeFromYaml ( file . Value ) ;
275266
276- if ( teamMetadata . RequestType == RequestType . CREATE_TEAM || teamMetadata . RequestType == RequestType . UPDATE_TEAM )
277- {
278- // Save the team
279- Team ? savedTeam = await SaveTeamInternal ( pullRequestEvent ? . Installation ? . Id , teamMetadata ) ;
267+ if ( teamMetadata . RequestType == RequestType . CREATE_TEAM || teamMetadata . RequestType == RequestType . UPDATE_TEAM )
268+ {
269+ // Save the team
270+ Team ? savedTeam = await SaveTeamInternal ( pullRequestEvent ? . Installation ? . Id , teamMetadata ) ;
280271
281- completeMessage = $ "{ _localizationService . GetLocalizedString ( Constants . ISSUE_COMPLETED ) } \n - Team: { savedTeam ? . HtmlUrl } ";
282- }
272+ completeMessage = $ "{ _localizationService . GetLocalizedString ( Constants . ISSUE_COMPLETED ) } \n - Team: { savedTeam ? . HtmlUrl } ";
283273 }
284274 }
285275 }
286276
287- if ( isComplete )
288- {
289- // Last step: Add a comment to the issue and close the issue
290- await _issueService . ChangeIssueLabel ( _gitHubOptions . RepoOnboarding , issueNumber , [ LocalizationExtensions . GetLocalizedString ( TicketStatus . COMPLETED . ToString ( ) ) ] , pullRequestEvent ! ) ;
277+ // Last step: Add a comment to the issue and close the issue
278+ await _issueService . ChangeIssueLabel ( _gitHubOptions . RepoOnboarding , issueNumber , [ LocalizationExtensions . GetLocalizedString ( TicketStatus . COMPLETED . ToString ( ) ) ] , pullRequestEvent ! ) ;
291279
292- await AddCommentToIssueAndPullRequest ( issueNumber , completeMessage , pullRequestEvent ! ) ;
280+ await AddCommentToIssueAndPullRequest ( issueNumber , completeMessage , pullRequestEvent ! ) ;
293281
294- await gitHubClient . Issue . Update ( owner , _gitHubOptions . RepoOnboarding , issueNumber , new IssueUpdate { State = ItemState . Closed } ) ;
295- }
282+ await gitHubClient . Issue . Update ( owner , _gitHubOptions . RepoOnboarding , issueNumber , new IssueUpdate { State = ItemState . Closed } ) ;
296283 }
297284 catch ( Exception ex )
298285 {
0 commit comments