|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 | # 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 |
10 | 6 | # pull request associated) and target branch (into which the pull request is |
11 | 7 | # 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. |
15 | 11 |
|
16 | 12 | # The following commands need to be installed before running the script: |
17 | 13 | # 1. git |
@@ -67,13 +63,6 @@ message="chore: generate libraries at $(date)" |
67 | 63 |
|
68 | 64 | git checkout "${target_branch}" |
69 | 65 | 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 |
77 | 66 | # copy generation configuration from target branch to current branch. |
78 | 67 | git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}" |
79 | 68 | config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true) |
|
0 commit comments