forked from open-telemetry/opentelemetry-java-contrib
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate-release-contributors.sh
More file actions
executable file
·92 lines (84 loc) · 2.85 KB
/
generate-release-contributors.sh
File metadata and controls
executable file
·92 lines (84 loc) · 2.85 KB
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
#!/bin/bash -e
# this should be run on the release branch
# NOTE if you need to run this script locally, you will need to first:
# git fetch upstream main
# git push origin upstream/main:main
# export GITHUB_REPOSITORY=open-telemetry/opentelemetry-java-contrib
from_version=$1
# get the date of the first commit that was not in the from_version
from=$(git log --reverse --pretty=format:"%cI" "$from_version..HEAD" | head -1)
# get the last commit on main that was included in the release
to=$(git merge-base origin/main HEAD | xargs git log -1 --pretty=format:"%cI")
contributors1=$(gh api graphql --paginate -F q="repo:$GITHUB_REPOSITORY is:pr base:main is:merged merged:$from..$to" -f query='
query($q: String!, $endCursor: String) {
search(query: $q, type: ISSUE, first: 100, after: $endCursor) {
edges {
node {
... on PullRequest {
author { login }
reviews(first: 100) {
nodes {
author { login }
}
}
comments(first: 100) {
nodes {
author { login }
}
}
closingIssuesReferences(first: 100) {
nodes {
author { login }
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}' --jq '.data.search.edges.[].node.author.login,
.data.search.edges.[].node.reviews.nodes.[].author.login,
.data.search.edges.[].node.comments.nodes.[].author.login,
.data.search.edges.[].node.closingIssuesReferences.nodes.[].author.login')
# this query captures authors of issues which have had PRs in the current range reference the issue
# but not necessarily through closingIssuesReferences (e.g. addressing just a part of an issue)
#
# note: [^0-9<&#;] below excludes HTML entity markers to avoid matching Ӓ as issue #1234
contributors2=$(gh api graphql --paginate -F q="repo:$GITHUB_REPOSITORY is:pr base:main is:merged merged:$from..$to" -f query='
query($q: String!, $endCursor: String) {
search(query: $q, type: ISSUE, first: 100, after: $endCursor) {
edges {
node {
... on PullRequest {
body
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
' --jq '.data.search.edges.[].node.body' \
| grep -oE "#[0-9]{3,}$|#[0-9]{3,}[^0-9<&#;]|$GITHUB_REPOSITORY/issues/[0-9]{3,}" \
| grep -oE "[0-9]{3,}" \
| xargs -I{} gh issue view {} --json 'author,url' --jq '[.author.login,.url]' \
| grep -v '/pull/' \
| sed 's/^\["//' \
| sed 's/".*//')
echo "$contributors1" "$contributors2" \
| sed 's/ /\n/g' \
| sort -uf \
| grep -v codecov \
| grep -v copilot-pull-request-reviewer \
| grep -v copilot-swe-agent \
| grep -v github-actions \
| grep -v github-advanced-security \
| grep -v linux-foundation-easycla \
| grep -v otelbot \
| grep -v renovate \
| sed 's/^/@/'