From 7400e108286a0fceacdac63b125fdc924c2dd50c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 25 Jul 2021 15:16:31 -0300 Subject: aux/: Update --- aux/ci/report.sh | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'aux/ci/report.sh') diff --git a/aux/ci/report.sh b/aux/ci/report.sh index 65d3335..1aa41a0 100755 --- a/aux/ci/report.sh +++ b/aux/ci/report.sh @@ -1,23 +1,47 @@ #!/bin/sh set -eu -PROJECT_UC="$1" +TLD="$(cat aux/tld.txt)" +. aux/lib.sh + +while getopts 'n:o:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + o) + OUTDIR="$OPTARG" + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} + +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${OUTDIR:-}" '-o OUTDIR' PASS='✅' FAIL='❌' -mkdir -p public/ci-logs public/ci-data +mkdir -p "$OUTDIR/ci-logs" "$OUTDIR/ci-data" -OUT="$(mktemp)" +OUT="$(mkstemp)" chmod 644 "$OUT" -git fetch origin refs/notes/*:refs/notes/* ||: - for c in $(git notes list | cut -d\ -f2); do DATA="$(git notes --ref=refs/notes/ci-data show "$c")" FILENAME="$(echo "$DATA" | cut -d\ -f2)" - echo "$DATA" > "public/ci-data/$FILENAME" - git notes --ref=refs/notes/ci-logs show "$c" > "public/ci-logs/$FILENAME" + echo "$DATA" > "$OUTDIR/ci-data/$FILENAME" + git notes --ref=refs/notes/ci-logs show "$c" > "$OUTDIR/ci-logs/$FILENAME" done cat <> "$OUT" @@ -27,6 +51,7 @@ cat <> "$OUT" + CI logs for $PROJECT