Unciv/.github/workflows/uncivbot.yml

47 lines
2.0 KiB
YAML
Raw Normal View History

2021-01-21 03:28:19 +07:00
name: UncivBot
on: [issue_comment]
jobs:
comment:
2021-01-21 03:42:47 +07:00
if: github.event.comment.body == 'summary'
2021-01-21 03:28:19 +07:00
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
2021-01-21 03:48:47 +07:00
var result = await github.repos.listCommits(context.repo({ per_page: 50 }));
2021-01-21 03:47:27 +07:00
//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})
2021-01-21 03:42:47 +07:00
//})
2021-01-21 03:47:27 +07:00
//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)
})