The code was erroneously comparing team name with the team slug which resulted in an otherwise approved PR not passing the check. The CODEOWNERS file must take team slugs instead of team names which is where the issue arises from.
Consider the following example.
Team
Name: "com.example.some name"
Slug: "com-example-some-name"
The code was taking the team name of "com.example.some name" and replacing only spaces with "-" which resulted in the code trying to compare "com.example.some-name" with "com-example-some-name" which then resulted in the check failing.
The code was erroneously comparing team name with the team slug which resulted in an otherwise approved PR not passing the check. The CODEOWNERS file must take team slugs instead of team names which is where the issue arises from. Consider the following example.
Team Name: "com.example.some name" Slug: "com-example-some-name"
CODEOWNERS File
* @owner-name/com-example-some-name
The code was taking the team name of "com.example.some name" and replacing only spaces with "-" which resulted in the code trying to compare "com.example.some-name" with "com-example-some-name" which then resulted in the check failing.