From 9d763280e98af0b44d8e1de7ecb3c029110c7059 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 24 Feb 2021 14:33:32 -0800 Subject: [PATCH] Closes #18164: on pre-push, check for uncommitted glean docs. --- config/pre-push-recommended.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/pre-push-recommended.sh b/config/pre-push-recommended.sh index 28e245997..9d140ce3d 100755 --- a/config/pre-push-recommended.sh +++ b/config/pre-push-recommended.sh @@ -14,6 +14,25 @@ # Descriptions for each gradle task below can be found in the # output of `./gradlew tasks`. +# Prevent push if generated glean docs are not committed. +# A better implementation would make sure these doc updates +# only came from this commit. +./gradlew -q \ + gleanGenerateMetricsDocsForDebug \ + gleanGenerateMetricsSourceForDebug +if git status --porcelain=v1 | grep -q "docs/metrics.md"; then + echo " +FAIL pre-push hook: generated glean file, docs/metrics.md, has uncommitted changes. +Please commit these files and try again. + +This check tries to prevent these generated files from being uncommitted on master. +However, it may fail unintuitively if we're in that state. If this happens often +and is disruptive to your workflow, please notify mcomella so we can improve this +check." >&2 + exit 1 +fi + +# Run core checks. ./gradlew -q \ ktlint \ detekt \