ci: update MAINTAINERS.yaml for each CODEOWNERS file change
Description
- This PR provides automation for updating the "MAINTAINERS.yaml" file in the
communityrepository.
Notes for Reviewer
-
Please watch the attached demo recordings:
-
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 -
I used the
rtCamp/action-slack-notifyaction; however, I also saw that you use8398a7/action-slack. Let me know if I should switch to it. -
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
CODEOWNERSfile 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
@asyncapi/bounty_team
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
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-requestinstead ofgit+gh pr - use
github-scriptand removepackage.json, and other config related files - add short "about" section directly in
update-maintainers.yamljob definition - introduce
githubIDprop, so in the next PR we can switch from comparing GitHub usernames to more reliable solution comparing GitHub profileidas 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
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
#docTriagersand#codeTriagersas specified in e.g.websiterepo- as you can see in this diff the
TRohit20 BhaswatiRoy VaishnaviNandakumar J0SALwere added whilesambhavgupta0705was not removed.
- as you can see in this diff the
- 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!
/ptal
@thulieblack Please take a look at this PR. Thanks! :wave:
I was PTALing mostly @derberg, but the code is good; why not make everyone look at it, sure?
/rtm