From 01fcd15139058b19e85adfa56244ce9ddd19b565 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 18 Jul 2024 15:46:01 +0000 Subject: [PATCH] Reapply "chore: trigger generation on changes to any file" This reverts commit 0c6cf738213cf23b81ac0a4cb90a0caf82b0750f. --- .../scripts/hermetic_library_generation.sh | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/scripts/hermetic_library_generation.sh b/.github/scripts/hermetic_library_generation.sh index b7a614d50..4cf0900a9 100644 --- a/.github/scripts/hermetic_library_generation.sh +++ b/.github/scripts/hermetic_library_generation.sh @@ -1,17 +1,13 @@ #!/bin/bash set -e # This script should be run at the root of the repository. -# This script is used to, when a pull request changes the generation -# configuration (generation_config.yaml by default): -# 1. Find whether the last commit in this pull request contains changes to -# the generation configuration and exit early if it doesn't have such a change -# since the generation result would be the same. -# 2. Compare generation configurations in the current branch (with which the +# This script is used to, when a pull request changes any file in the repo: +# 1. Compare generation configurations in the current branch (with which the # pull request associated) and target branch (into which the pull request is # merged); -# 3. Generate changed libraries using library_generation image; -# 4. Commit the changes to the pull request, if any. -# 5. Edit the PR body with generated pull request description, if applicable. +# 2. Generate changed libraries using library_generation image; +# 3. Commit the changes to the pull request, if any. +# 4. Edit the PR body with generated pull request description, if applicable. # The following commands need to be installed before running the script: # 1. git @@ -67,13 +63,6 @@ message="chore: generate libraries at $(date)" git checkout "${target_branch}" git checkout "${current_branch}" -# if the last commit doesn't contain changes to generation configuration, -# do not generate again as the result will be the same. -change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)" -if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then - echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true - exit 0 -fi # copy generation configuration from target branch to current branch. git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}" config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)