1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-08-13 16:53:48 -04:00
xeps/tools/ci-changed-builds.sh
Jonas Schäfer b028cca04d ci: use git merge-base to detect changed files
This prevents false positives if the branch is not rebased on
current main.
2020-06-14 15:46:56 +02:00

14 lines
452 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
IFS=$'\n'
filenames="$(git diff-tree -r --no-commit-id --name-status "$(git merge-base "$1" HEAD)" HEAD | ( grep -P '^[AM]\t(xep-[0-9]{4}|inbox/[^/]+)\.xml$' || true) | cut -f2)"
if [ -z "$filenames" ]; then
exit 0
fi
mkdir -p rendered-changes/
cp xmpp.css prettify.css rendered-changes/
for filename in $filenames; do
built_filename="build/${filename/%.xml/.html}"
cp "$built_filename" rendered-changes/
done