community icon indicating copy to clipboard operation
community copied to clipboard

ci: update MAINTAINERS.yaml for each CODEOWNERS file change

Open mszostok opened this issue 1 year ago • 3 comments

Description

  • This PR provides automation for updating the "MAINTAINERS.yaml" file in the community repository.

Notes for Reviewer

  1. Please watch the attached demo recordings:

  2. Please check the README.md which describes how it works.

    Click to see the flow diagram

    sequenceDiagram
        Refresher->>Refresher: Load API calls cache 
    
        note over Refresher, GitHub: Uses GraphQL
        Refresher->>+GitHub: Get all AsyncAPI repositories
    
        GitHub-->>-Refresher: Repository list
    
    
        Refresher->>Refresher: "Remove ignored repositories"
    
        rect rgb(191, 223, 255)
        note over Refresher, GitHub: Uses REST API
    
        loop For each repository
            Refresher->>+GitHub: Get CODEOWNERS file
            note over  Refresher: Detect the default branch
            note over  Refresher: Check for file in all valid locations
            GitHub-->>-Refresher: CODEOWNERS content
        end
        end
    
        rect rgb(191, 223, 255)
        note over Refresher, GitHub: Uses REST API
    
        Refresher->>Refresher: "Remove ignored users"
    
        loop For each unique codeowner
            Refresher->>+GitHub: Get codeowner GitHub profile
            GitHub-->>-Refresher: GitHub profile
        end
        end
    
    
        loop For previous maintainer
            alt is invalid
            Refresher->>Refresher: Delete if either GitHub profile was removed <br> or they doesn't own any repository currently.
            else is valid
            Refresher->>Refresher: Refresh only the 'repos' property.
            end
        end
    
        Refresher->>Refresher: Append any new maintainers not present in the previous list.
    
        Refresher->>Refresher: Prints details on why a maintainer was removed or changed directly
    
        Refresher->>Refresher: Save API calls cache
    
  3. I used the rtCamp/action-slack-notify action; however, I also saw that you use 8398a7/action-slack. Let me know if I should switch to it.

  4. To keep the code simple, a full refresh is performed. This doesn't introduce any additional risks:

    • The logic takes up to 30 seconds only.
    • Hitting API rate limits is also not an issue:
      • The rate limit for GITHUB_TOKEN is 1,000 requests per hour per repository.
      • The update job executes 126 requests. However, thanks to conditional requests, for the next run, if there are no changes, all those calls don't count against your rate limit. So, if there is a CODEOWNERS file change from a single repository, it will use just 1 call.

Related Issue(s)

Blocked by: https://github.com/asyncapi/community/pull/1314 and https://github.com/asyncapi/github-action-for-cli/pull/397

Fixes: https://github.com/asyncapi/community/issues/1269

mszostok avatar Jul 19 '24 21:07 mszostok

@asyncapi/bounty_team

aeworxet avatar Jul 22 '24 01:07 aeworxet

don't worry about what actions for slack notifications is better -> we are not very consistent in this area 😄 -> https://github.com/asyncapi/.github/blob/master/.github/workflows/automerge-orphans.yml#L61

derberg avatar Jul 27 '24 18:07 derberg

Thank you for the review! 🙇

Here is the https://github.com/asyncapi/community/pull/1315/commits/255d2e76af71f69e4887b60d06c0b0cc5ba1dff5 commit that contains the following changes:

  • rebase with master
  • use peter-evans/create-pull-request instead of git + gh pr
  • use github-script and remove package.json, and other config related files
  • add short "about" section directly in update-maintainers.yaml job definition
  • introduce githubID prop, so in the next PR we can switch from comparing GitHub usernames to more reliable solution comparing GitHub profile id as specified here.

Here is the GitHub run where I tested the all provided changes: https://github.com/refresh-maintainers-demo/community/actions/runs/10134304231/job/28020379271

mszostok avatar Jul 28 '24 20:07 mszostok

Hi 👋 Here is the https://github.com/asyncapi/community/pull/1315/commits/fde97753d771a02d7624d590e93b629ff3bd53f2 commit that contains the following changes:

  • take into account the usernames under #docTriagers and #codeTriagers as specified in e.g. website repo
    • as you can see in this diff the TRohit20 BhaswatiRoy VaishnaviNandakumar J0SAL were added while sambhavgupta0705 was not removed.
  • update the cron to run at 10:00 AM UTC every Sunday.

Here is the GitHub run where I tested the all provided changes: https://github.com/refresh-maintainers-demo/community/actions/runs/10211359115/job/28252539643

Cheers!

mszostok avatar Aug 02 '24 07:08 mszostok

/ptal

aeworxet avatar Aug 12 '24 22:08 aeworxet

@thulieblack Please take a look at this PR. Thanks! :wave:

asyncapi-bot avatar Aug 12 '24 22:08 asyncapi-bot

I was PTALing mostly @derberg, but the code is good; why not make everyone look at it, sure?

aeworxet avatar Aug 12 '24 22:08 aeworxet

/rtm

derberg avatar Aug 21 '24 14:08 derberg