Skip to content

Conversation

@marians
Copy link
Member

@marians marians commented Aug 15, 2023

I'm mostly scratching my own itch here, but think this should be available to everyone.

This PR adds a subcommand devctl repo find which allows to list repositories in the giantswarm org that match some very specific criteria.

With about 1300 repositories it is otherwise hard to find repositories that have no README, or broken CODEOWNERS, or a default branch named "master", to name just some examples.

Regarding logic, this isn't fancy. The command iterates over all repositories and fetches the required info. If a repository matches, information gets printed.

General syntax

devctl repo find --what CRITERION_1[,CRITERION_2][,CRITERION_N] [--must-have-codeowners]
  • --what (required) defines the search criteria. When multiple are given, returned repositories must match at least one.
  • --must-have-codeowners can be applied to specify that the returned repositories must have the /CODEOWNERS file in the repo. This skips repos which don't have any ownership assigned. (Obviously not useful in combination with criterion NO_CODEOWNERS)

Available criteria

    DEFAULT_BRANCH_MASTER
    
        The default branch is named 'master'. We want to rename these to 'main'.
    
    HAS_DOCS_DIR
    
        The repo has a directory named 'docs' on the root level. This is the place
        where we want to store technical documentation for the repo.

    HAS_PR_TEMPLATE_IN_DOCS
    
        Has the file docs/pull_request_template.md, which is not the desired location.
        We want this to be in .github/pull_request_template.md.

    BAD_CODEOWNERS

        Finds repositories with errors in CODEOWNERS files.
    
    NO_CODEOWNERS
    
        There is no CODEOWNERS file in the root folder, which means that the repository
        has no owner. We want repos to have owners, ideally.

    NO_DESCRIPTION
    
        Repository description is missing. We want a meaningful description to be present,
        to understand easily what the repository is about, even from lists.
    
    NO_README

        Repository has no README.md file in the root folder. We want thjis to be present,
        to have some basic info and documentation available.

    README_OLD_CIRCLECI_BAGDE
    
        There is an outdated (broken) CircleCI badge is present in the README. This should
        better get replaced by an up-to-date one, as it can otherwise not fulfil its purpose,
        and broken images never make a good impression.

    README_OLD_GODOC_LINK

        The README contains an outdated godoc.org link. Should be pkg.go.dev nowadays.

Example

Details
$ go run main.go repo find --what BAD_CODEOWNERS,NO_CODEOWNERS,NO_DESCRIPTION,NO_README

- [ ] https://github.com/giantswarm/aws-resolver-rules-operator
  - Repository has no description (NO_DESCRIPTION)

- [ ] https://github.com/giantswarm/capi-hook-demo
  - /README.md not present (NO_README)
  - Repository has no description (NO_DESCRIPTION)

- [ ] https://github.com/giantswarm/crossplane-examples
  - Repository has no description (NO_DESCRIPTION)

- [ ] https://github.com/giantswarm/opsgenie-team-analysis
  - /README.md not present (NO_README)

...

@marians marians self-assigned this Aug 15, 2023
@marians marians marked this pull request as ready for review August 16, 2023 13:03
@marians marians requested a review from a team as a code owner August 16, 2023 13:03
Copy link
Contributor

@gusevda gusevda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice feature!

@marians marians requested review from ljakimczuk and removed request for ljakimczuk September 14, 2023 09:13
@marians
Copy link
Member Author

marians commented Sep 14, 2023

Sorry, just committed to this branch by mistake. Will revert.

@pipo02mix
Copy link
Contributor

do we still want to have it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants