Skip to content

Commit b6da7c8

Browse files
committed
chore: trigger generation on changes to any file
1 parent 80cd61d commit b6da7c8

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

.github/scripts/hermetic_library_generation.sh

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/bin/bash
22
set -e
33
# This script should be run at the root of the repository.
4-
# This script is used to, when a pull request changes the generation
5-
# configuration (generation_config.yaml by default):
6-
# 1. Find whether the last commit in this pull request contains changes to
7-
# the generation configuration and exit early if it doesn't have such a change
8-
# since the generation result would be the same.
9-
# 2. Compare generation configurations in the current branch (with which the
4+
# This script is used to, when a pull request changes any file in the repo:
5+
# 1. Compare generation configurations in the current branch (with which the
106
# pull request associated) and target branch (into which the pull request is
117
# merged);
12-
# 3. Generate changed libraries using library_generation image;
13-
# 4. Commit the changes to the pull request, if any.
14-
# 5. Edit the PR body with generated pull request description, if applicable.
8+
# 2. Generate changed libraries using library_generation image;
9+
# 3. Commit the changes to the pull request, if any.
10+
# 4. Edit the PR body with generated pull request description, if applicable.
1511

1612
# The following commands need to be installed before running the script:
1713
# 1. git
@@ -67,13 +63,6 @@ message="chore: generate libraries at $(date)"
6763

6864
git checkout "${target_branch}"
6965
git checkout "${current_branch}"
70-
# if the last commit doesn't contain changes to generation configuration,
71-
# do not generate again as the result will be the same.
72-
change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
73-
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
74-
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
75-
exit 0
76-
fi
7766
# copy generation configuration from target branch to current branch.
7867
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
7968
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)

0 commit comments

Comments
 (0)