File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # This script will generate a temporary file with all the ssh keys of the
3
+ # approvers of a given team name in the OWNERS_ALIASES file of a given project.
4
+ # The script will return the path of the temporary file.
5
+ # The script will return 1 if the script fails to curl the OWNER_ALIASES file
6
+ # or if the yq command is not found.
7
+
8
+ set -Eeuo pipefail
9
+
10
+ GITHUB_PROJECT=" ${GITHUB_PROJECT:- openshift/ installer} "
11
+ TEAM_NAME=" ${TEAM_NAME:- openstack-approvers} "
12
+
13
+ if ! command -v yq & > /dev/null; then
14
+ echo " yq could not be found"
15
+ echo " https://github.com/mikefarah/yq"
16
+ exit 1
17
+ fi
18
+
19
+ OWNER_ALIASES=$( curl -s " https://raw.githubusercontent.com/${GITHUB_PROJECT} /master/OWNERS_ALIASES" )
20
+ if [ -z " $OWNER_ALIASES " ]; then
21
+ echo " Failed to curl the OWNER_ALIASES from ${GITHUB_PROJECT} "
22
+ exit 1
23
+ fi
24
+
25
+ # shellcheck disable=SC2016
26
+ MEMBERS=$( echo " $OWNER_ALIASES " | yq --arg team_name " $TEAM_NAME " -r ' .aliases[$team_name] | join(" ")' )
27
+
28
+ TMP_FILE=$( mktemp)
29
+ for member in $MEMBERS ; do
30
+ curl -s " https://github.com/$member .keys" >> " $TMP_FILE "
31
+ done
32
+
33
+ echo " $TMP_FILE "
You can’t perform that action at this time.
0 commit comments