Skip to content

Commit e26bc25

Browse files
authored
chore: do not exit early if there's no code change (#3203)
In this PR: - Do not exit if there's no code change. Context: we found an issue in bigtable (googleapis/java-bigtable#2336) such that PR description is overwritten by subsequent commit due to config updates. However, the generation associated with that [commit](googleapis/java-bigtable@b6e7e1d) didn't have code change (because the code change is already committed) and exit early so the PR description is not changed back.
1 parent 02eea8d commit e26bc25

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/scripts/hermetic_library_generation.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ docker run \
9999
rm -rdf output googleapis "${baseline_generation_config}"
100100
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
101101
changed_files=$(git diff --cached --name-only)
102-
if [[ "${changed_files}" == "" ]]; then
103-
echo "There is no generated code change."
104-
echo "Skip committing to the pull request."
105-
exit 0
102+
if [[ "${changed_files}" != "" ]]; then
103+
echo "Commit changes..."
104+
git commit -m "${message}"
105+
git push
106+
else
107+
echo "There is no generated code change, skip commit."
106108
fi
107109

108-
git commit -m "${message}"
109-
git push
110110
# set pr body if pr_description.txt is generated.
111111
if [[ -f "pr_description.txt" ]]; then
112112
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")

0 commit comments

Comments
 (0)