Team does not belong to organization
Closed this issue ยท 5 comments
Description
Upgrading to version 0.7.0 makes the Github action fail, whereas version 0.6.0 passed. The action is configured as follows
- uses: mszostok/codeowners-validator@v0.7.0
with:
checks: files,duppatterns,syntax,owners
experimental_checks: notowned
github_access_token: ${{ secrets.GITHUB_PAT }}
With a CODEOWNERS file that looks like so
* @org/team
Expected result
The action should not fail
Actual result
The action fails with the following message
[err] line 1: Team "@org/team" does not belong to "Org" organization.
Steps to reproduce
Since the issue relates to Github organization, unable to share a repository for reproduction
Troubleshooting
- Read the release notes
- Verified that the team exists
- Verified that the action passes when changing only the version back to 0.6.0
- Verified that the organization and teams in the codeowners file is written with the same case as it appears in Github
Is this a bug in version 0.7.0?
Is something missing in the action configuration?
Thank you for your work
Hi!
Thanks for letting me know!
Root cause
This was a side effect of #78 (comment) where not only team was normalized. Unfortunately, it was not detected by the integration test, as I used only the gh-codeowners organization. As you can see, it's all lower-case.
To reproduce the problem, I created a new organization GitHubCODEOWNERS and executed the v0.7 against it and ran into the same problem: https://github.com/GitHubCODEOWNERS/codeowners-samples/runs/5173200010?check_suite_focus=true
I tested that further to check whether GitHub also is case-insensitive for Organization names:
- CODEOWNERS: https://github.com/GitHubCODEOWNERS/codeowners-samples/blob/happy-path/CODEOWNERS#L10-L11
- Example PR: GitHubCODEOWNERS/codeowners-samples#1
As you can see, code owners were properly assigned.
Corrective and Preventative Measures
To fix that problem, I created this PR: #122 and tested also against a newly created organization: https://github.com/GitHubCODEOWNERS/codeowners-samples/runs/5173279973?check_suite_focus=true
I also added new integration tests against new GitHubCODEOWNERS organization to ensure no regression in the future.
Additional Corrective and Preventative Measures
In this case it's a bit of revers engineering as I don't have access to GitHub code which is responsible for assigning owners. As a result, I will need to create yet another e2e test that will be executed periodically to:
- Create a sample PR against files where
@GiTHubCodeOwners/A-TeAm
is specified and check whether GitHub is still case-insensitive and assigns@GitHubCodeowners/a-team
properly.
In this way, I will be notified when GitHub will change its behavior and I will be able to release a new version that will match a changed functionality.
@mszostok THANKS A MILLION
any idea when you will release a new version with the fix?
I will release it in a moment ๐
@foolioo please let me know if this issue was fixed for you in mszostok/codeowners-validator@v0.7.1
๐ then I will close this issue.
@mszostok version 0.7.1 works for me