From 1b9b1fcc5db5741e70a60a6e3e5d2b85dacea47d Mon Sep 17 00:00:00 2001 From: Sahal Ansari Date: Fri, 18 Oct 2024 23:15:49 -0500 Subject: [PATCH] added script to generate diff table for PRs. --- scripts/generate-diff-links.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/generate-diff-links.sh diff --git a/scripts/generate-diff-links.sh b/scripts/generate-diff-links.sh new file mode 100755 index 0000000..f538fd6 --- /dev/null +++ b/scripts/generate-diff-links.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset + +GIT_HASH="${1:-50aeb31ff80e7bdde9b8edd50ab924e3791fe606}" + +BASE_LOCAL_URL="http://127.0.0.1:8000/bash-hackers-wiki/" +BASE_DEPLOY_URL="https://flokoe.github.io/bash-hackers-wiki/" +BASE_ARCHIVE_URL="https://web.archive.org/web/20230127020427/https://wiki.bash-hackers.org/" + +# Table Headers +cat << EOF +|Filename|Local Version|Deployed Version|Archive Version| +|--|--|--|--| +EOF + +for file in $(git show --name-only "${GIT_HASH}" | grep md$); do + filename_no_docs_prefix="${file#*docs/}" + filename_no_ext="${filename_no_docs_prefix%.*}" + echo "|"${filename_no_docs_prefix} \ + "|[${filename_no_ext}](${BASE_LOCAL_URL}${filename_no_ext})" \ + "|[${filename_no_ext}](${BASE_DEPLOY_URL}${filename_no_ext})" \ + "|[${filename_no_ext}](${BASE_ARCHIVE_URL}${filename_no_ext})|" +done +