From 1437872df9ed4ec09fc5276d5f6fc7be03f8ea5f Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Wed, 3 Jan 2024 13:30:16 -0800 Subject: [PATCH] infra: fail check_diffs if too many files changed (#15423) Jobs like https://github.com/langchain-ai/langchain/actions/runs/7389187843/job/20101494206 only receive the first 300 changed files. Because of the opportunity to miss packages, better to auto-fail and manually run. Checking that it does what I expect in #15424 --- .github/scripts/check_diff.py | 7 ++++++- .github/workflows/check_diffs.yml | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check_diff.py b/.github/scripts/check_diff.py index a10dee9ec32..15192fe5daf 100644 --- a/.github/scripts/check_diff.py +++ b/.github/scripts/check_diff.py @@ -13,6 +13,10 @@ if __name__ == "__main__": files = sys.argv[1:] dirs_to_run = set() + if len(files) == 300: + # max diff length is 300 files - there are likely files missing + raise ValueError("Max diff reached. Please manually run CI on changed libs.") + for file in files: if any( file.startswith(dir_) @@ -48,4 +52,5 @@ if __name__ == "__main__": dirs_to_run.update(LANGCHAIN_DIRS) else: pass - print(json.dumps(list(dirs_to_run))) + json_output = json.dumps(list(dirs_to_run)) + print(f"dirs-to-run={json_output}") diff --git a/.github/workflows/check_diffs.yml b/.github/workflows/check_diffs.yml index 442d2ebdb49..83dd2d58638 100644 --- a/.github/workflows/check_diffs.yml +++ b/.github/workflows/check_diffs.yml @@ -27,7 +27,8 @@ jobs: - id: files uses: Ana06/get-changed-files@v2.2.0 - id: set-matrix - run: echo "dirs-to-run=$(python .github/scripts/check_diff.py ${{ steps.files.outputs.all }})" >> $GITHUB_OUTPUT + run: | + python .github/scripts/check_diff.py ${{ steps.files.outputs.all }} >> $GITHUB_OUTPUT outputs: dirs-to-run: ${{ steps.set-matrix.outputs.dirs-to-run }} ci: