-
Notifications
You must be signed in to change notification settings - Fork 953
/
build-changelog.js
97 lines (93 loc) · 2.86 KB
/
build-changelog.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const fs = require('fs')
let value = fs.readFileSync('./change-log.json')
value = JSON.parse(value)
const inDone = value.data.search.edges[0].node.project.columns.edges[0].node.cards.edges
let data = ''
const prCount = inDone.filter((card) => {
return card.node.content.url
}).length
console.log(prCount, 'PRs found!\n')
data = prCount + ' PRs found!\n\n'
for (let card of inDone) {
if (card.node.content.url && card.node.content.merged) {
data += ` - [${card.node.content.title}](${card.node.content.url}) (@${card.node.content.author.login})\n`
data += ` participants: (${card.node.content.participants.edges.map((p) => { return ` @${p.node.login}` })})`
data += '\n\n'
}
}
console.log('change-log.txt updated')
fs.writeFileSync('./change-log.txt', data)
/*
- Go to https://docs.github.com/en/graphql/overview/explorer
- Set the correct project id
- Run the below mentioned query (be careful, this only returns the first 100 elements)
- Save the JSON content as change-log.json
- Run this script i.e. build-changelog.js
- Use the result from the file change-log.txt to write changelog on Github release
*/
/*
{
search(type: REPOSITORY, query: "remix-project", first: 1) {
edges {
node {
__typename
... on Repository {
owner {
id
}
name
project(number: 31) {
number
name
columns(last: 1) {
edges {
node {
name
cards(first: 100) {
edges {
cursor
node {
id
note
state
content {
... on PullRequest {
participants (last: 100) {
edges {
node {
id
login
}
}
}
author {
login
}
assignees (last: 100) {
edges {
node {
id
login
}
}
}
url
merged
id
number
title
}
}
}
}
}
}
}
}
}
}
}
}
}
}
*/