ci: preventing manual changes in erpnext/locale/*

This commit is contained in:
diptanilsaha
2026-03-08 23:35:17 +05:30
parent f67cfc48e0
commit 5d66be710f
2 changed files with 83 additions and 0 deletions

39
.github/helper/locale_review.js vendored Normal file
View File

@@ -0,0 +1,39 @@
module.exports = async ({ github, context, localeChanged }) => {
const pr = context.payload.pull_request.number
const { owner, repo } = context.repo
const { data: me } = await github.rest.users.getAuthenticated()
const botUser = me.login
const reviews = await github.rest.pulls.listReviews({
owner,
repo,
pull_number: pr
})
const botReview = reviews.data
.reverse()
.find(r => r.user.login === botUser && r.state === "CHANGES_REQUESTED")
if (localeChanged) {
if (!botReview) {
await github.rest.pulls.createReview({
owner,
repo,
pull_number: pr,
event: "REQUEST_CHANGES",
body: "Translations are managed through [Crowdin](https://crowdin.com/project/frappe/). Consider contributing through Crowdin."
})
}
} else {
if (botReview) {
await github.rest.pulls.dismissReview({
owner,
repo,
pull_number: pr,
review_id: botReview.id,
message: ""
})
}
}
}