mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Update uncivbot.yml
This commit is contained in:
parent
c1b9fc677d
commit
def0ebc147
62
.github/workflows/uncivbot.yml
vendored
62
.github/workflows/uncivbot.yml
vendored
@ -12,35 +12,35 @@ jobs:
|
|||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
var result = await context.github.repos.listCommits(context.repo({ per_page: 50 }));
|
var result = await context.github.repos.listCommits(context.repo({ per_page: 50 }));
|
||||||
var commitSummary = "";
|
//var commitSummary = "";
|
||||||
var ownerToCommits = {}
|
//var ownerToCommits = {}
|
||||||
var reachedPreviousVersion = false
|
//var reachedPreviousVersion = false
|
||||||
result.data.forEach(commit => {
|
//result.data.forEach(commit => {
|
||||||
if(reachedPreviousVersion) return
|
// if(reachedPreviousVersion) return
|
||||||
var author = commit.author.login
|
// var author = commit.author.login
|
||||||
if(author=="uncivbot[bot]") return
|
// if(author=="uncivbot[bot]") return
|
||||||
var commitMessage = commit.commit.message.split("\n")[0];
|
// var commitMessage = commit.commit.message.split("\n")[0];
|
||||||
if(commitMessage.match(/^\d+\.\d+\.\d+$/)){ // match EXACT version, like 3.4.55 ^ is for start-of-line, $ for end-of-line
|
// if(commitMessage.match(/^\d+\.\d+\.\d+$/)){ // match EXACT version, like 3.4.55 ^ is for start-of-line, $ for end-of-line
|
||||||
reachedPreviousVersion=true
|
// reachedPreviousVersion=true
|
||||||
console.log(commitMessage)
|
// console.log(commitMessage)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if(commitMessage.startsWith("Merge ")) return
|
// if(commitMessage.startsWith("Merge ")) return
|
||||||
commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345)
|
// commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345)
|
||||||
if (author != owner){
|
// if (author != owner){
|
||||||
if (ownerToCommits.get(author)==undefined) ownerToCommits.set(author,[])
|
// if (ownerToCommits.get(author)==undefined) ownerToCommits.set(author,[])
|
||||||
ownerToCommits.get(author)?.push(commitMessage)
|
// ownerToCommits.get(author)?.push(commitMessage)
|
||||||
}
|
// }
|
||||||
else commitSummary += "\n\n" + commitMessage
|
// else commitSummary += "\n\n" + commitMessage
|
||||||
});
|
//});
|
||||||
ownerToCommits.forEach((commits,author)=>{
|
//ownerToCommits.forEach((commits,author)=>{
|
||||||
commitSummary += "\n\nBy "+author+":"
|
// commitSummary += "\n\nBy "+author+":"
|
||||||
commits.forEach(commitMessage => {commitSummary+="\n- "+commitMessage})
|
// commits.forEach(commitMessage => {commitSummary+="\n- "+commitMessage})
|
||||||
})
|
|
||||||
context.github.issues.createComment(context.issue({ body: commitSummary }));
|
|
||||||
//github.issues.createComment({
|
|
||||||
// issue_number: context.issue.number,
|
|
||||||
// owner: context.repo.owner,
|
|
||||||
// repo: context.repo.repo,
|
|
||||||
// body: "${{ github.event.comment.body }}"
|
|
||||||
//})
|
//})
|
||||||
|
//context.github.issues.createComment(context.issue({ body: commitSummary }));
|
||||||
|
github.issues.createComment({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: toJson(result)
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user