drop scripts/generate-pull-request-report.sh
People on HackerOne keep reporting this file as containing a secret token. The reality is that this token is no longer usable since it was published to a public repo, which would have caused it to be revoked automatically though GitHub automation: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning Other than that I'm pretty sure nobody is using this script. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
e2c18ea151
commit
85348306ce
|
@ -1,82 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Github Client Credentials
|
||||
# Required to increase rate limits to a useable level.
|
||||
|
||||
GITHUB_CLIENT_ID=cae8611e191547e163bb
|
||||
GITHUB_CLIENT_SECRET=ebcfe4e78a6bb96933a3e2476a6d1e8efa8d8b07
|
||||
|
||||
# Generates a markdown report for the pull requests given in STDIN
|
||||
# The input format should match the output of list-pull-requests.sh:
|
||||
# [pr #] [tab] [github pr api url] [tab] [comma separated list of commits]
|
||||
|
||||
usage() {
|
||||
echo "DESCRIPTION"
|
||||
echo ""
|
||||
# Generates a markdown report for the pull requests given in STDIN
|
||||
# The input format should match the output of list-pull-requests.sh:
|
||||
# [pr #] [tab] [github pr api url] [tab] [comma separated list of commits]
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
fatal() {
|
||||
echo "FATAL: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo_json() {
|
||||
local json=$1
|
||||
local path=$2
|
||||
echo -n "$json" | jq -r "$path"
|
||||
}
|
||||
|
||||
check_pr_prereq() {
|
||||
if ! command -v jq >/dev/null; then
|
||||
fatal "jq(1) is not found, PR cannot be queried."
|
||||
fi
|
||||
if ! command -v curl >/dev/null; then
|
||||
fatal "curl(1) is not found, PR cannot be queried."
|
||||
fi
|
||||
}
|
||||
|
||||
fetch() {
|
||||
local url="$1?client_id=$GITHUB_CLIENT_ID&client_secret=$GITHUB_CLIENT_SECRET"
|
||||
fetch_result=$(curl --fail -fsS "$url")
|
||||
if [ $? -ne 0 ]; then fatal "Unable to get fetch from $1"; fi
|
||||
}
|
||||
|
||||
process_stdin() {
|
||||
while IFS= read -r line; do
|
||||
local pr_url=`echo "$line" | cut -f 2`
|
||||
echo_pull_request "$pr_url"
|
||||
done
|
||||
}
|
||||
|
||||
echo_pull_request() {
|
||||
local pr_url=$1
|
||||
fetch "$pr_url"
|
||||
local pr=$fetch_result
|
||||
|
||||
echo "## $(echo_json "$pr" .title) (#$(echo_json "$pr" .number))
|
||||
|
||||
URL: $(echo_json "$pr" .html_url)
|
||||
Creator: $(echo_json "$pr" .user.login)
|
||||
Labels: $(echo_json "$pr" ' [.labels[].name] | join(", ") ' )
|
||||
|
||||
$(echo_json "$pr" .body)
|
||||
|
||||
"
|
||||
}
|
||||
|
||||
check_pr_prereq
|
||||
|
||||
echo "# Pull Request Report
|
||||
|
||||
$( process_stdin )
|
||||
|
||||
"
|
Loading…
Reference in New Issue