From def0ebc147f6c18be2a3d54cab04044085b42012 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 20 Jan 2021 22:47:27 +0200 Subject: [PATCH] Update uncivbot.yml --- .github/workflows/uncivbot.yml | 62 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/uncivbot.yml b/.github/workflows/uncivbot.yml index e8dc66ddab..78be99b943 100644 --- a/.github/workflows/uncivbot.yml +++ b/.github/workflows/uncivbot.yml @@ -12,35 +12,35 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} script: | var result = await context.github.repos.listCommits(context.repo({ per_page: 50 })); - var commitSummary = ""; - var ownerToCommits = {} - var reachedPreviousVersion = false - result.data.forEach(commit => { - if(reachedPreviousVersion) return - var author = commit.author.login - if(author=="uncivbot[bot]") return - 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 - reachedPreviousVersion=true - console.log(commitMessage) - return - } - if(commitMessage.startsWith("Merge ")) return - commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345) - if (author != owner){ - if (ownerToCommits.get(author)==undefined) ownerToCommits.set(author,[]) - ownerToCommits.get(author)?.push(commitMessage) - } - else commitSummary += "\n\n" + commitMessage - }); - ownerToCommits.forEach((commits,author)=>{ - commitSummary += "\n\nBy "+author+":" - 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 }}" + //var commitSummary = ""; + //var ownerToCommits = {} + //var reachedPreviousVersion = false + //result.data.forEach(commit => { + // if(reachedPreviousVersion) return + // var author = commit.author.login + // if(author=="uncivbot[bot]") return + // 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 + // reachedPreviousVersion=true + // console.log(commitMessage) + // return + // } + // if(commitMessage.startsWith("Merge ")) return + // commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345) + // if (author != owner){ + // if (ownerToCommits.get(author)==undefined) ownerToCommits.set(author,[]) + // ownerToCommits.get(author)?.push(commitMessage) + // } + // else commitSummary += "\n\n" + commitMessage + //}); + //ownerToCommits.forEach((commits,author)=>{ + // commitSummary += "\n\nBy "+author+":" + // 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: toJson(result) + })