Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: trigger generation on commits affecting any file #1659

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
52362ed
restore to older point
diegomarquezp Jun 6, 2024
4221ad2
infer image tag from config yaml
diegomarquezp Jun 12, 2024
a140494
correct workflow name
diegomarquezp Jun 12, 2024
fc8a89f
update config scripts and yamls
diegomarquezp Jun 12, 2024
8cf2251
remove old update_googleapis_committish workflow
diegomarquezp Jun 20, 2024
636af7c
sync config structure with that of google-cloud-java
diegomarquezp Jun 20, 2024
02e9b6e
remove quotes from config yamls
diegomarquezp Jun 25, 2024
f57bc67
fix typo in update_generation_config.yaml
diegomarquezp Jun 25, 2024
a2ff23b
correct
diegomarquezp Jun 25, 2024
68fd72b
quote codeowners_team in generation config
diegomarquezp Jun 26, 2024
f11b300
update generator version
diegomarquezp Jun 26, 2024
23a15a8
fix path to hermetic_library_generation
diegomarquezp Jul 2, 2024
8f6d04a
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 2, 2024
5d7760f
Merge branch 'main' into main
diegomarquezp Jul 2, 2024
80cd61d
fixes to hermetic_library_generation
diegomarquezp Jul 2, 2024
b6da7c8
chore: trigger generation on changes to any file
diegomarquezp Jul 18, 2024
a28fa98
test change to trigger generation
diegomarquezp Jul 18, 2024
0e4e06d
Revert "test change to trigger generation"
diegomarquezp Jul 18, 2024
0c6cf73
Revert "chore: trigger generation on changes to any file"
diegomarquezp Jul 18, 2024
0af6a48
test change in readme-partials to trigger generation
diegomarquezp Jul 18, 2024
d6b22d8
Revert "test change in readme-partials to trigger generation"
diegomarquezp Jul 18, 2024
0b36f7c
always use current generation config to generate everything
diegomarquezp Jul 18, 2024
01fcd15
Reapply "chore: trigger generation on changes to any file"
diegomarquezp Jul 18, 2024
d7e9215
Merge branch 'main' into main
diegomarquezp Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/bin/bash
set -e
# This script should be run at the root of the repository.
# This script is used to, when a pull request changes the generation
# configuration (generation_config.yaml by default):
# 1. Find whether the last commit in this pull request contains changes to
# the generation configuration and exit early if it doesn't have such a change
# since the generation result would be the same.
# 2. Compare generation configurations in the current branch (with which the
# This script is used to, when a pull request changes any file in the repo:
# 1. Compare generation configurations in the current branch (with which the
# pull request associated) and target branch (into which the pull request is
# merged);
# 3. Generate changed libraries using library_generation image;
# 4. Commit the changes to the pull request, if any.
# 5. Edit the PR body with generated pull request description, if applicable.
# 2. Generate changed libraries using library_generation image;
# 3. Commit the changes to the pull request, if any.
# 4. Edit the PR body with generated pull request description, if applicable.

# The following commands need to be installed before running the script:
# 1. git
Expand Down Expand Up @@ -67,13 +63,6 @@ message="chore: generate libraries at $(date)"

git checkout "${target_branch}"
git checkout "${current_branch}"
# if the last commit doesn't contain changes to generation configuration,
# do not generate again as the result will be the same.
change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
exit 0
fi
# copy generation configuration from target branch to current branch.
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
Expand All @@ -87,7 +76,6 @@ docker run \
-u "$(id -u):$(id -g)" \
-v "$(pwd):${workspace_name}" \
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
--current-generation-config-path="${workspace_name}/${generation_config}"


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:

jobs:
library_generation:
# skip pull requests come from a forked repository
# skip pull requests coming from a forked repository
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
Expand Down
Loading