Skip to content

Script to generate authors files by version for Bibtex #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions reference/authors-v1.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# v1.0.0 Authors

⚠️ Do not edit this file directly.
It is [auto-generated](../scripts/authors-by-version.sh) from Git history of source files in this repo.

ℹ️ Note this is purely a convenience for referencing in academic papers.
See the full Git history of specific files for additional context.

## Authors List

- Andrew Block <[email protected]>
- Brian Fox <[email protected]>
- Brian Fox <[email protected]>
- Brice Fernandes <[email protected]>
- Cansu Kavılı Örnek <[email protected]>
- Carlos Santana <[email protected]>
- Carlos Santana <[email protected]>
- Chris Sanders <[email protected]>
- Chris Short <[email protected]>
- Christian Hernandez <[email protected]>
- Cornelia Davis <[email protected]>
- Dan Garfield <[email protected]>
- Daniel Warner <[email protected]>
- Florian Heubeck <[email protected]>
- Ishita Sequeira <[email protected]>
- Jesse Butler <[email protected]>
- John Pitman <[email protected]>
- Kevin Bowersox <[email protected]>
- Kingdon Barrett <[email protected]>
- Leonardo Murillo <[email protected]>
- Leonardo Murillo <[email protected]>
- Lloyd Chang <[email protected]>
- Lothar Schulz <[email protected]>
- Michael Bridgen <[email protected]>
- Moshe Immerman <[email protected]>
- Nicholas Thomson <[email protected]>
- Nicholas Thomson <[email protected]>
- Piotr <[email protected]>
- Regina Scott <[email protected]>
- Robert A Ficcaglia <[email protected]>
- Roberth Strand <[email protected]>
- Schlomo Schapiro <[email protected]>
- Scott Rigby <[email protected]>
- Sean Sundberg <[email protected]>
- Shoubhik Bose <[email protected]>
- Timothy Lin <[email protected]>
- Toni Menzel <[email protected]>
- William Caban <[email protected]>
- William Chia <[email protected]>
- lloydchang <[email protected]>
99 changes: 99 additions & 0 deletions scripts/authors-by-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash

# Example usage:
# mkdir -p reference
# for VERSION in v1.0.0 HEAD; do
# ./scripts/authors-by-version.sh $VERSION > reference/authors-$VERSION.md
# done

# Authors, comitters, co-authors
get_authors() {
local git_tag="$1"
shift # Shift arguments to get the files
local files="$*"
# shellcheck disable=SC2086
git --no-pager log "$git_tag" -- $files | \
sed -n -e 's/^Author: //p' -e 's/^Committer: //p' -e 's/^.*Co-authored-by: //p' | \
sort -u | sed -e 's/^/- /'
}

# Ensure tag argument is provided
GIT_TAG=$1

if [[ -z ${GIT_TAG} ]]; then
echo "Usage: $0 <git-tag>"
exit 1
fi

if [ ! "$(git tag -l "$GIT_TAG")" ] && [ ! "$GIT_TAG" == "HEAD" ]; then
echo "<git-tag> '$GIT_TAG' does not exist"
exit 1
fi

# Check if translations
git show "$GIT_TAG":i18n > /dev/null 2>&1 && i18n=true || i18n=false


# Output
cat <<EOF
# $GIT_TAG Authors

⚠️ Do not edit this file directly.
It is [auto-generated](../scripts/authors-by-version.sh) from Git history of source files in this repo.

ℹ️ Note this is purely a convenience for referencing in academic papers.
See the full Git history of specific files for additional context.

EOF

# If translations exist, output a note about language and translations
if [[ $i18n = true ]]; then
cat <<EOF
## Language and Translations

The GitOps Principles and Glossary are [authored](#authors-list) in English.
See farther below for a list of [translators](#translators-list) by language.

EOF
fi

# Get authors list
AUTHORS=$(get_authors "$GIT_TAG" "PRINCIPLES.md GLOSSARY.md")

# Append to output
cat <<EOF
## Authors List

$AUTHORS
EOF

# If translations exist, append translator lists
if [[ $i18n = true ]]; then
# Get translator lists
DE=$(get_authors "$GIT_TAG" i18n/*_de.md)
ES=$(get_authors "$GIT_TAG" i18n/*_es.md)
PT=$(get_authors "$GIT_TAG" i18n/*_pt.md)
FR=$(get_authors "$GIT_TAG" i18n/*_fr.md)

# Append to output
cat <<EOF

## Translators List

### German

$DE

### Spanish

$ES

### Portuguese

$PT

### French

$FR
EOF
fi