File: generate-authors.sh

package info (click to toggle)
golang-github-pion-sctp 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, sid, trixie
  • size: 888 kB
  • sloc: makefile: 13
file content (69 lines) | stat: -rwxr-xr-x 1,767 bytes parent folder | download
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
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

set -e

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
if [ -z "${AUTHORS_PATH}" ]; then
  AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"
fi

if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
  . ${SCRIPT_PATH}/.ci.conf
fi

#
# DO NOT EDIT THIS
#
EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot' 'pionbot')
# If you want to exclude a name from all repositories, send a PR to
# https://github.com/pion/.goassets instead of this repository.
# If you want to exclude a name only from this repository,
# add EXCLUDED_CONTRIBUTORS=('name') to .github/.ci.conf

CONTRIBUTORS=()

shouldBeIncluded () {
	for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do
		if [[ $1 =~ "$i" ]]; then
			return 1
		fi
	done
	return 0
}


IFS=$'\n' #Only split on newline
for CONTRIBUTOR in $(
	(
		git log --format='%aN <%aE>'
		git log --format='%(trailers:key=Co-authored-by)' | sed -n 's/^[^:]*:\s*//p'
	) | LC_ALL=C.UTF-8 sort -uf
); do
	if shouldBeIncluded ${CONTRIBUTOR}; then
		CONTRIBUTORS+=("${CONTRIBUTOR}")
	fi
done
unset IFS

if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
	cat >${AUTHORS_PATH} <<-'EOH'
# Thank you to everyone that made Pion possible. If you are interested in contributing
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
#
# This file is auto generated, using git to list all individuals contributors.
# see `.github/generate-authors.sh` for the scripting
EOH
    for i in "${CONTRIBUTORS[@]}"; do
	    echo "$i" >> ${AUTHORS_PATH}
    done
    exit 0
fi