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

feat: implement comment-check in workflows. #3426

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mo3et
Copy link
Contributor

@mo3et mo3et commented Sep 18, 2024

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.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 18, 2024
@shenqidebaozi
Copy link
Member

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
Copy link
Contributor Author

mo3et commented Sep 18, 2024

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
Copy link
Member

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

@mo3et
Copy link
Contributor Author

mo3et commented Sep 19, 2024

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.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 20, 2024
@mo3et mo3et changed the title [WIP] feat: implement comment-check in workflows. feat: implement comment-check in workflows. Sep 20, 2024
@mo3et
Copy link
Contributor Author

mo3et commented Sep 20, 2024

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
Copy link
Contributor Author

mo3et commented Sep 20, 2024

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.


  • Test comment effect when CI failed in our repo
image
  • bot comment CI failed details
image

@shenqidebaozi
Copy link
Member

Understood, let me add a key

@mo3et
Copy link
Contributor Author

mo3et commented Sep 21, 2024

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
Copy link
Contributor Author

mo3et commented Sep 21, 2024

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

@kratos-ci-bot
Copy link
Collaborator

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
Copy link
Contributor Author

mo3et commented Oct 8, 2024

@shenqidebaozi @Windfarer @daemon365

Hello, can your have a check this PR?

@shenqidebaozi shenqidebaozi added this to the v2.8.2 milestone Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add Chinese Comment Check Workflow to Kratos CI
3 participants