64
64
65
65
image_tag=local
66
66
workspace_name=" /workspace"
67
- baseline_generation_config=" baseline_generation_config.yaml"
68
67
docker_file=" library_generation.Dockerfile"
69
68
message=" chore: generate libraries at $( date) "
70
69
71
- git checkout " ${target_branch} "
72
70
git checkout " ${current_branch} "
73
- # if the last commit doesn't contain changes to generation configuration,
74
- # do not generate again as the result will be the same.
71
+ # if the last commit doesn't contain changes to generation configuration
72
+ # or Dockerfile, do not generate again as the result will be the same.
75
73
change_of_last_commit=" $( git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r) "
76
74
if [[ ! (" ${change_of_last_commit} " == * " ${generation_config} " * || " ${change_of_last_commit} " == * " ${docker_file} " * ) ]]; then
77
75
echo " The last commit doesn't contain any changes to the generation_config.yaml or Dockerfile, skipping the whole generation process." || true
78
76
exit 0
79
77
fi
80
- # copy generation configuration from target branch to current branch.
81
- git show " ${target_branch} " :" ${generation_config} " > " ${baseline_generation_config} "
82
- config_diff=$( diff " ${generation_config} " " ${baseline_generation_config} " || true)
83
78
84
79
generator_version=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl gapic-generator-java)
85
80
echo " Local generator version: ${generator_version} "
@@ -99,22 +94,18 @@ docker run \
99
94
-v " $( pwd) :${workspace_name} " \
100
95
-v " $HOME " /.m2:/home/.m2 \
101
96
-e GENERATOR_VERSION=" ${generator_version} " \
102
- gcr.io/cloud-devrel-public-resources/java-library-generation:" ${image_tag} " \
103
- --baseline-generation-config-path=" ${workspace_name} /${baseline_generation_config} " \
104
- --current-generation-config-path=" ${workspace_name} /${generation_config} "
97
+ gcr.io/cloud-devrel-public-resources/java-library-generation:" ${image_tag} "
105
98
106
99
# commit the change to the pull request.
107
- rm -rdf output googleapis " ${baseline_generation_config} "
100
+ rm -rdf output googleapis
108
101
git add --all -- ' :!pr_description.txt'
109
102
changed_files=$( git diff --cached --name-only)
110
103
if [[ " ${changed_files} " == " " ]]; then
111
- echo " There is no generated code change with the generation config and Dockerfile change ${config_diff} ."
104
+ echo " There is no generated code change."
112
105
echo " Skip committing to the pull request."
113
106
exit 0
114
107
fi
115
108
116
- echo " Configuration diff:"
117
- echo " ${config_diff} "
118
109
git commit -m " ${message} "
119
110
git push
120
111
# set pr body if pr_description.txt is generated.
0 commit comments