go-kratos / kratos

Your ultimate Go microservices framework for the cloud-native era.
https://go-kratos.dev
MIT License
23.43k stars 4.01k forks source link

feat: implement comment-check in workflows. #3426

Open mo3et opened 2 months ago

mo3et commented 2 months ago

Description (what this PR does / why we need it):

implement comment check in workflows when commit PR have Chinese. If check files have a Chinese, CI will failed.

Which issue(s) this PR fixes (resolves / be part of):

Fixes #3422

Other special notes for the reviewers:

Need remove test Chinese comments when PR is merged.

shenqidebaozi commented 2 months ago

It seems to be effective. Does he check the entire code every time? Also, can we directly comment on the issue in the PR, otherwise we still need to check the action details

mo3et commented 2 months ago

It seems to be effective. Does he check the entire code every time? Also, can we directly comment on the issue in the PR, otherwise we still need to check the action details

This Check only run when pull request into main branch or workflow_dispatch.

I think it is feasible to have the bot comment on the error details. I will add this part in a later commit.

shenqidebaozi commented 2 months ago

What I mean is, can we only check the code for PR changes? Instead of scanning the full code

mo3et commented 2 months ago

What I mean is, can we only check the code for PR changes? Instead of scanning the full code

I tried to implement checking only the diff, and it works. However, I think this approach ignores existing errors and doesn’t handle them properly. Since this CI process only scans text and isn’t time-consuming, I recommend scanning the entire repo.

If you wish, I will implement a version that checks only the diff.

mo3et commented 2 months ago

I’ve updated the version to only check the diff files in the PR and commented out the whole repo check version.

I also added a bot comment when the check fails. If you think it looks good, I’ll push the final version.

mo3et commented 2 months ago

I try to use secrets.GITHUB_TOKEN and secrets.BOT_GITHUB_TOKEN. It is not work. I think it this PAT is lose issues:write and pull-requests: write permissions. I try to in our repos is success.

I need to help provide the Bot PAT having issues:write and pull-requests: write. Like secrets.BOT_GITHUB_TOKEN but have more premissions.


image image
shenqidebaozi commented 2 months ago

Understood, let me add a key

mo3et commented 2 months ago

Understood, let me add a key

Sorry, my bad. We just need to use the ci_bot_token from the translator issue workflow. The reason is pull_request use PR creator branch permission. But fork repo NOT upstream repo permission. Need use pull_request_target.

But use pull_request_target need this PR is merged, different from pull_request just have in PR creator branch. It can call upstream repo workflows.

If any errors after this PR is merged, please tell me know and I’ll fix it.

The CI failure effect after this PR is merged.

mo3et commented 2 months ago

同时也辛苦包子哥哥这几天的跟进和回复 感谢!

kratos-ci-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


At the same time, thank you very much for Brother Baozi’s follow-up and reply these days!

mo3et commented 1 month ago

@shenqidebaozi @Windfarer @daemon365

Hello, can your have a check this PR?

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.69%. Comparing base (4e9dac0) to head (a5b06ee). Report is 10 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3426 +/- ## ========================================== - Coverage 84.12% 81.69% -2.43% ========================================== Files 89 92 +3 Lines 4182 4327 +145 ========================================== + Hits 3518 3535 +17 - Misses 471 601 +130 + Partials 193 191 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: