Update uncivbot.yml

This commit is contained in:
Yair Morgenstern
2021-01-23 19:28:46 +02:00
committed by GitHub
parent 26afb16b6b
commit 8fb13749df

View File

@ -29,7 +29,7 @@ jobs:
console.log(commitMessage) console.log(commitMessage)
return return
} }
if (commitMessage.startsWith("Merge ")) return if (commitMessage.startsWith("Merge ") || commitMessage.startsWith("Update ")) return
commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345) commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345)
if (author != context.repo.owner){ if (author != context.repo.owner){
if (ownerToCommits[author] == undefined) ownerToCommits[author]=[] if (ownerToCommits[author] == undefined) ownerToCommits[author]=[]
@ -77,19 +77,31 @@ jobs:
return repo.data.default_branch return repo.data.default_branch
} }
console.log(await getDefaultBranch()) var translations = "translations"
console.log(await branchExists("translations"))
//async function createTranslationBranchIfNeeded(context: Context<Webhooks.WebhookPayloadIssueComment>) { async function createTranslationBranchIfNeeded() {
// if (await branchExists(context, translations)) return if (await branchExists(translations)) return
var defaultBranch = await getDefaultBranch()
var currentHead = await context.github.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'heads/' + defaultBranch })
var currentSha = currentHead.data.object.sha
app.log("Current sha: " + currentSha)
await context.github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/`+translations,
sha: currentSha }))
await context.github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Translations branch created' })
}
await createTranslationBranchIfNeeded()
// var defaultBranch = await getDefaultBranch(context)
// var currentHead = await context.github.git.getRef(context.repo({ ref: 'heads/' + defaultBranch }))
// var currentSha = currentHead.data.object.sha
// app.log("Current sha: " + currentSha)
// await context.github.git.createRef(context.repo({ ref: `refs/heads/translations`, sha: currentSha }))
// await context.github.issues.createComment(context.issue({ body: 'Translations branch created' }))
//}
//async function createTranslationPrIfNeeded(context: Context<Webhooks.WebhookPayloadIssueComment>, //async function createTranslationPrIfNeeded(context: Context<Webhooks.WebhookPayloadIssueComment>,
// owner: string, translations: string) { // owner: string, translations: string) {
// var translationPulls = await context.github.pulls.list(context.repo({ state: "open", head: owner + ":" + translations })); // var translationPulls = await context.github.pulls.list(context.repo({ state: "open", head: owner + ":" + translations }));