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

[PROPOSAL] Build a GitHub app / workflow that runs on each PR that modifies the CODEOWNERS and MAINTAINERS files to make sure they are in sync #177

Open
AMoo-Miki opened this issue Sep 21, 2023 · 7 comments
Labels
good first issue Good for newcomers

Comments

@AMoo-Miki
Copy link
Contributor

What/Why

What are you proposing?

A method for preventing CODEOWNERS and MAINTAINERS from drifting apart.

What users have asked for this feature?

Repository maintainers would like to have a workflow / app that examines changes made to CODEOWNERS and MAINTAINERS in a PR and fail if they are not in sync.

What problems are you trying to solve? Why should it be built? Any reason not to?

Repository maintainers are not a fan of manually reviewing changes made to CODEOWNERS and MAINTAINERS to make sure they are in sync.

What is the developer experience going to be?

A developer making changes to either of CODEOWNERS and MAINTAINERS files will have their PRs fail if the two files are not in sync. Developers of PRs that have no changes to CODEOWNERS and MAINTAINERS will have the workflow skipped.

Are there any security considerations?

The workflow / app will not have access to verify the accuracy of the CODEOWNERS and MAINTAINERS files; it only checks if they are in sync.

@AMoo-Miki AMoo-Miki changed the title [PROPOSAL] [PROPOSAL] Build a GitHub app / workflow that runs on each PR that modifies the CODEOWNERS and MAINTAINERS files to make sure they are in sync Sep 21, 2023
@peternied peternied added good first issue Good for newcomers and removed untriaged labels Sep 21, 2023
@hakunamatata-git
Copy link

hakunamatata-git commented Oct 17, 2023

Hello @AMoo-Miki @peternied , I am new to contributing to opensource project. I would like to work on this.
I have checked the MAINTAINERS.md and CODEOWNERS files. They both not following the similar format. Eg: MAINTAINERS.md this file is displaying the "Maintainer | GitHub ID | Affiliation" where as CODEOWNERS file displaying "@xyz @abc @123 @abc @xyz"

If I do diff, or delta or compare the comparison fails. The contents of the file is not same. May I know exactly what needs to be checked before failing the PR. Does CODEOWNERS file must look same as MAINTAINERS file or vice versa?

Thanks in advance.

@peternied
Copy link
Member

@hakunamatata-git Thanks for your interest, the files are not in the same format so diffs would be expected not to match. Coming up with a structured way to read the files and interpret the different maintainers definitions would be part of this work to resolve this issue.

@hakunamatata-git
Copy link

Hello @peternied @AMoo-Miki @dblock I have wrote this yaml. Can some one please validate if I am on the right path.
sync-check.yaml.zip

@dblock
Copy link
Member

dblock commented Nov 13, 2023

      - name: Check if .github/CODEOWNERS and MAINTAINERS.md are in sync
        run: |
          if [ "$(cat .github/CODEOWNERS)" != "$(cat MAINTAINERS.md)" ]; then
            echo ".github/CODEOWNERS and MAINTAINERS.md files are not in sync."
            exit 1
          fi

The contents of these files are completely different, they need to be parsed.

@hakunamatata-git
Copy link

Hello @dblock @peternied @AMoo-Miki Thank you for the response. I have parsed the files and ran locally to test the script. Please validate and let me know if I'm in the right direction.
compare_files.zip

@dblock
Copy link
Member

dblock commented Nov 24, 2023

Please validate and let me know if I'm in the right direction.

Thanks!

Comparison is only one part of the problem. Your implementation is not as generic as the Ruby code I linked, so I think it's not the right direction, plus going from Ruby to Python is not the goal.

We're looking for a GitHub action that one can reuse in any repo that performs the task asked here. Examples of reusable GitHub actions are on the GitHub marketplace: https://github.com/marketplace. I want to be able to write something like this:

- name: Check CODEOWNERS vs. MAINTAINERS
   uses: actions/codeowners-maintainers@v1

And it should be appending errors to the GitHub pull request when these are out of sync.

Btw, you should be creating GitHub repos for your code, don't attach zips ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants