代码拉取完成,页面将自动刷新
同步操作将从 Mudlet/Mudlet 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const {danger, fail, message, warn} = require('danger');
const SOURCE_REGEX = /.*\.(cpp|c|h|lua)$/i
const TITLE_REGEX = /^(fix|improve|add|infra)/i
const touched_files = [...danger.git.created_files, ...danger.git.modified_files]
const sourcefiles = touched_files.filter(item => item.match(SOURCE_REGEX))
const pr_title = danger.github.pr.title
// Checks the title to make sure it matches expectations
const title_type = pr_title.match(TITLE_REGEX)
if (title_type) {
// no-op
} else if(pr_title.match(/^\[?WIP\]?/i)) {
fail("PR is still a WIP, do not merge")
} else {
fail("PR title must start with `fix`, `improve`, `add` or `infra` for release notes purposes.")
}
// checks sourcefile changes to ensure any new TODO items also have a Mudlet issue
sourcefiles.forEach(function(filename) {
const additions = danger.git.diffForFile(filename)
additions.then(diff => {
diff.added.split("\n").forEach(function(item) {
if (item.includes("TODO:")) {
fail(`Source file ${filename} includes a TODO! Can you make the change right away? If no, better not to create a TODO - they just tend to hang around and never get fixed.`)
}
})
})
})
// Warns if a PR touched more than 10 source files.
if (sourcefiles.length > 10) {
warn(`PR makes changes to ${sourcefiles.length} source files. Double check the scope hasn't gotten out of hand`)
}
// Warns if the title is perhaps a bit verbose
const title_wordcount = pr_title.split(" ").length
if (title_wordcount > 25) {
warn(`PR title is ${title_wordcount} words long, double check it will make a good changelog line`)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。