Skip to content

Commit

Permalink
chore: do not exit early if there's no code change (#3203)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JoeWang1127 committed Sep 16, 2024
1 parent 02eea8d commit e26bc25
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ docker run \
rm -rdf output googleapis "${baseline_generation_config}"
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" == "" ]]; then
echo "There is no generated code change."
echo "Skip committing to the pull request."
exit 0
if [[ "${changed_files}" != "" ]]; then
echo "Commit changes..."
git commit -m "${message}"
git push
else
echo "There is no generated code change, skip commit."
fi

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

0 comments on commit e26bc25

Please sign in to comment.