From 85348306cebf57c711bd1b9900d661303a61a519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 21 Sep 2021 17:51:49 +0200 Subject: [PATCH] drop scripts/generate-pull-request-report.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/generate-pull-request-report.sh | 82 ------------------------- 1 file changed, 82 deletions(-) delete mode 100755 scripts/generate-pull-request-report.sh diff --git a/scripts/generate-pull-request-report.sh b/scripts/generate-pull-request-report.sh deleted file mode 100755 index 7c3f31e6b7..0000000000 --- a/scripts/generate-pull-request-report.sh +++ /dev/null @@ -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 ) - -"