Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team does not belong to organization #121

Closed
electriquo opened this issue Feb 13, 2022 · 5 comments · Fixed by #122
Closed

Team does not belong to organization #121

electriquo opened this issue Feb 13, 2022 · 5 comments · Fixed by #122
Assignees
Labels
bug Something isn't working

Comments

@electriquo
Copy link

electriquo commented Feb 13, 2022

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

@mszostok
Copy link
Owner

mszostok commented Feb 13, 2022

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:

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.

@electriquo
Copy link
Author

electriquo commented Feb 13, 2022

@mszostok THANKS A MILLION
any idea when you will release a new version with the fix?

@mszostok
Copy link
Owner

I will release it in a moment 👍

@mszostok
Copy link
Owner

@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 mszostok reopened this Feb 13, 2022
@electriquo
Copy link
Author

@mszostok version 0.7.1 works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants