Skip to content

Commit 4ea81f1

Browse files
authored
chore: Add .java and .proto files to same diff branch (#8488)
Changes - Add workflow_dispatch to manually run the action - Add .java and .proto diffs to same branch - Exclude certain non .java files (files excluded from owlbot.py)
1 parent a8aafa4 commit 4ea81f1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/generate_diffs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
on:
16+
workflow_dispatch:
1617
push:
1718
branches:
1819
- main

generation/generate_diff.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*</.*>' |
6969
for module in $modules; do
7070
echo "Running for ${module}"
7171
rm -rf "${module}"
72-
retry_with_backoff 3 10 git clone "https://github.com/googleapis/${module}"
73-
rm -rf "${module}/.git"
72+
url="https://github.com/googleapis/${module}"
73+
if curl --output /dev/null --silent --head --fail "${url}"; then
74+
retry_with_backoff 3 10 git clone "${url}"
75+
rm -rf "${module}/.git"
76+
fi
7477
echo "Done running for ${module}"
7578
done
7679

@@ -87,8 +90,10 @@ git stash
8790
git checkout "${current_branch}"
8891
git stash pop
8992

93+
# *.java and *.proto are connected -- Adding them to the same branch
9094
git checkout -b "${diff_java_branch}"
9195
git add "*.java"
96+
git add "*.proto"
9297
git commit -m "chore: Adding java diffs" --no-verify
9398
git push origin "${diff_java_branch}" --force
9499

@@ -97,8 +102,17 @@ git checkout "${current_branch}"
97102
git stash pop
98103

99104
git checkout -b "${diff_non_java_branch}"
105+
100106
git add .
107+
ignore_list=("java-*/.github/*" "java-*/.kokoro/*" "java-*/samples/*" "java-*/CODE_OF_CONDUCT.md" "java-*/CONTRIBUTING.md" "java-*/LICENSE" "java-*/SECURITY.md" "java-*/java.header" "java-*/license-checks.xml" "java-*/renovate.json")
108+
109+
for ignore in "${ignore_list[@]}"
110+
do
111+
git reset "${ignore}"
112+
done
101113
git commit -m "chore: Adding non-java diffs" --no-verify
102114
git push origin "${diff_non_java_branch}" --force
103115

116+
git checkout "${current_branch}"
117+
104118
echo "Done running script"

0 commit comments

Comments
 (0)