mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 20:48:49 -04:00
Updates summary action to use node.js script
This commit is contained in:
parent
43ebab9050
commit
d030ce7182
47
.github/workflows/uncivbot.yml
vendored
47
.github/workflows/uncivbot.yml
vendored
@ -155,50 +155,9 @@ jobs:
|
||||
# This is the only place I could find an apparent list of valid author associations. Also, at least they're not case-sensitive: https://docs.github.com/en/graphql/reference/enums#commentauthorassociation https://docs.github.com/en/actions/learn-github-actions/expressions#contains
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
var result = await github.repos.listCommits({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.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 ") || commitMessage.startsWith("Update ")) return
|
||||
commitMessage = commitMessage.replace(/\(\#\d+\)/,"") // match PR auto-text, like (#2345)
|
||||
if (author != context.repo.owner){
|
||||
if (ownerToCommits[author] == undefined) ownerToCommits[author]=[]
|
||||
ownerToCommits[author].push(commitMessage)
|
||||
}
|
||||
else commitSummary += "\n\n" + commitMessage
|
||||
});
|
||||
Object.entries(ownerToCommits).forEach(entry => {
|
||||
const [author, commits] = entry;
|
||||
if (commits.length==1) commitSummary += "\n\n" + commits[0] + " - By "+author
|
||||
else {
|
||||
commitSummary += "\n\nBy "+author+":"
|
||||
commits.forEach(commitMessage => { commitSummary += "\n- "+commitMessage })
|
||||
}
|
||||
})
|
||||
github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: commitSummary
|
||||
})
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- run: node .github/workflows/createChangelogEntry.js ${{ secrets.ACTIONS_ACCESS_TOKEN }}
|
||||
|
||||
merge_translations:
|
||||
if: github.event_name == 'workflow_dispatch' || (github.event.comment.body == 'merge translations' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
|
||||
|
Loading…
x
Reference in New Issue
Block a user