Skip to content

Commit a6a7d83

Browse files
authored
Script to generate authors files by version for Bibtex (#82)
* Script to generate authors files by version for Bibtex * Add example usage * Generated v1.0.0 authors reference file * Update note at the top of the top of generated files * Regenerate authors-v1.0.0.md * Use sort -u and check arg only once * make shellcheck happy * conditional bracket consistency --------- Co-authored-by: Christian Hernandez <[email protected]> Signed-off-by: Scott Rigby <[email protected]>
1 parent 00079cc commit a6a7d83

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

reference/authors-v1.0.0.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# v1.0.0 Authors
2+
3+
⚠️ Do not edit this file directly.
4+
It is [auto-generated](../scripts/authors-by-version.sh) from Git history of source files in this repo.
5+
6+
ℹ️ Note this is purely a convenience for referencing in academic papers.
7+
See the full Git history of specific files for additional context.
8+
9+
## Authors List
10+
11+
- Andrew Block <[email protected]>
12+
- Brian Fox <[email protected]>
13+
- Brian Fox <[email protected]>
14+
- Brice Fernandes <[email protected]>
15+
- Cansu Kavılı Örnek <[email protected]>
16+
- Carlos Santana <[email protected]>
17+
- Carlos Santana <[email protected]>
18+
- Chris Sanders <[email protected]>
19+
- Chris Short <[email protected]>
20+
- Christian Hernandez <[email protected]>
21+
- Cornelia Davis <[email protected]>
22+
- Dan Garfield <[email protected]>
23+
- Daniel Warner <[email protected]>
24+
- Florian Heubeck <[email protected]>
25+
- Ishita Sequeira <[email protected]>
26+
- Jesse Butler <[email protected]>
27+
- John Pitman <[email protected]>
28+
- Kevin Bowersox <[email protected]>
29+
- Kingdon Barrett <[email protected]>
30+
- Leonardo Murillo <[email protected]>
31+
- Leonardo Murillo <[email protected]>
32+
- Lloyd Chang <[email protected]>
33+
- Lothar Schulz <[email protected]>
34+
- Michael Bridgen <[email protected]>
35+
- Moshe Immerman <[email protected]>
36+
- Nicholas Thomson <[email protected]>
37+
- Nicholas Thomson <[email protected]>
38+
39+
- Regina Scott <[email protected]>
40+
- Robert A Ficcaglia <[email protected]>
41+
- Roberth Strand <[email protected]>
42+
- Schlomo Schapiro <[email protected]>
43+
- Scott Rigby <[email protected]>
44+
- Sean Sundberg <[email protected]>
45+
- Shoubhik Bose <[email protected]>
46+
- Timothy Lin <[email protected]>
47+
- Toni Menzel <[email protected]>
48+
- William Caban <[email protected]>
49+
- William Chia <[email protected]>
50+
- lloydchang <[email protected]>

scripts/authors-by-version.sh

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
# Example usage:
4+
# mkdir -p reference
5+
# for VERSION in v1.0.0 HEAD; do
6+
# ./scripts/authors-by-version.sh $VERSION > reference/authors-$VERSION.md
7+
# done
8+
9+
# Authors, comitters, co-authors
10+
get_authors() {
11+
local git_tag="$1"
12+
shift # Shift arguments to get the files
13+
local files="$*"
14+
# shellcheck disable=SC2086
15+
git --no-pager log "$git_tag" -- $files | \
16+
sed -n -e 's/^Author: //p' -e 's/^Committer: //p' -e 's/^.*Co-authored-by: //p' | \
17+
sort -u | sed -e 's/^/- /'
18+
}
19+
20+
# Ensure tag argument is provided
21+
GIT_TAG=$1
22+
23+
if [[ -z ${GIT_TAG} ]]; then
24+
echo "Usage: $0 <git-tag>"
25+
exit 1
26+
fi
27+
28+
if [ ! "$(git tag -l "$GIT_TAG")" ] && [ ! "$GIT_TAG" == "HEAD" ]; then
29+
echo "<git-tag> '$GIT_TAG' does not exist"
30+
exit 1
31+
fi
32+
33+
# Check if translations
34+
git show "$GIT_TAG":i18n > /dev/null 2>&1 && i18n=true || i18n=false
35+
36+
37+
# Output
38+
cat <<EOF
39+
# $GIT_TAG Authors
40+
41+
⚠️ Do not edit this file directly.
42+
It is [auto-generated](../scripts/authors-by-version.sh) from Git history of source files in this repo.
43+
44+
ℹ️ Note this is purely a convenience for referencing in academic papers.
45+
See the full Git history of specific files for additional context.
46+
47+
EOF
48+
49+
# If translations exist, output a note about language and translations
50+
if [[ $i18n = true ]]; then
51+
cat <<EOF
52+
## Language and Translations
53+
54+
The GitOps Principles and Glossary are [authored](#authors-list) in English.
55+
See farther below for a list of [translators](#translators-list) by language.
56+
57+
EOF
58+
fi
59+
60+
# Get authors list
61+
AUTHORS=$(get_authors "$GIT_TAG" "PRINCIPLES.md GLOSSARY.md")
62+
63+
# Append to output
64+
cat <<EOF
65+
## Authors List
66+
67+
$AUTHORS
68+
EOF
69+
70+
# If translations exist, append translator lists
71+
if [[ $i18n = true ]]; then
72+
# Get translator lists
73+
DE=$(get_authors "$GIT_TAG" i18n/*_de.md)
74+
ES=$(get_authors "$GIT_TAG" i18n/*_es.md)
75+
PT=$(get_authors "$GIT_TAG" i18n/*_pt.md)
76+
FR=$(get_authors "$GIT_TAG" i18n/*_fr.md)
77+
78+
# Append to output
79+
cat <<EOF
80+
81+
## Translators List
82+
83+
### German
84+
85+
$DE
86+
87+
### Spanish
88+
89+
$ES
90+
91+
### Portuguese
92+
93+
$PT
94+
95+
### French
96+
97+
$FR
98+
EOF
99+
fi

0 commit comments

Comments
 (0)