Skip to content

chore(ci): enable workflows and scripts on preview (#15581)#15584

Merged
noahdietz merged 1 commit intogoogleapis:previewfrom
noahdietz:preview-ci
Feb 19, 2026
Merged

chore(ci): enable workflows and scripts on preview (#15581)#15584
noahdietz merged 1 commit intogoogleapis:previewfrom
noahdietz:preview-ci

Conversation

@noahdietz
Copy link
Contributor

Cherry pick commit from main for #15581.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @noahdietz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the continuous integration (CI) pipeline by introducing greater flexibility in how conditional tests are executed. By parameterizing the target branch for Git operations, the CI workflows can now be effectively run against branches other than main, such as a preview branch, without requiring manual modifications. This change streamlines the testing process for different development stages.

Highlights

  • CI Script Flexibility: Modified ci/run_conditional_tests.sh to use a configurable TARGET_BRANCH variable, defaulting to main, instead of hardcoding main for Git operations.
  • Conditional Test Execution: Updated conditional logic for presubmit and continuous builds to reference the TARGET_BRANCH for fetching history and determining diffs.
Changelog
  • ci/run_conditional_tests.sh
    • Introduced TARGET_BRANCH variable to dynamically specify the branch for Git diff and fetch operations.
    • Updated presubmit and continuous build logic to utilize the new TARGET_BRANCH variable.
    • Switched if condition syntax from [ ... ] to [[ ... ]] for improved shell scripting practices.
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/docs.yml
    • .github/workflows/lint.yml
    • .github/workflows/unittest.yml
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@noahdietz noahdietz marked this pull request as ready for review February 19, 2026 18:23
@noahdietz noahdietz requested review from a team as code owners February 19, 2026 18:23
@noahdietz noahdietz requested a review from parthea February 19, 2026 18:23
@noahdietz noahdietz merged commit f9210ea into googleapis:preview Feb 19, 2026
45 checks passed
@noahdietz noahdietz deleted the preview-ci branch February 19, 2026 18:25
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the run_conditional_tests.sh script to be more flexible by allowing a configurable target branch instead of a hardcoded main branch. The changes also improve the script's robustness by using [[...]] for tests. The code is well-written. I've added one suggestion to refactor a conditional block to reduce code duplication and improve maintainability.

Comment on lines +42 to +56
if [[ ${BUILD_TYPE} == "presubmit" ]]; then
# For presubmit build, we want to know the difference from the
# common commit in origin/main.
GIT_DIFF_ARG="origin/main..."
# common commit in the target branch.
GIT_DIFF_ARG="origin/$TARGET_BRANCH..."

# Then fetch enough history for finding the common commit.
git fetch origin main --deepen=200
git fetch origin "$TARGET_BRANCH" --deepen=200

elif [ ${BUILD_TYPE} == "continuous" ]; then
elif [[ ${BUILD_TYPE} == "continuous" ]]; then
# For continuous build, we want to know the difference in the last
# commit. This assumes we use squash commit when merging PRs.
GIT_DIFF_ARG="HEAD~.."

# Then fetch one last commit for getting the diff.
git fetch origin main --deepen=1
git fetch origin "$TARGET_BRANCH" --deepen=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and reduce code duplication, this conditional logic can be refactored. By setting a FETCH_DEPTH variable within the if/elif blocks, you can use a single git fetch command afterwards. This makes the script's intent clearer and easier to modify in the future.

Suggested change
if [[ ${BUILD_TYPE} == "presubmit" ]]; then
# For presubmit build, we want to know the difference from the
# common commit in origin/main.
GIT_DIFF_ARG="origin/main..."
# common commit in the target branch.
GIT_DIFF_ARG="origin/$TARGET_BRANCH..."
# Then fetch enough history for finding the common commit.
git fetch origin main --deepen=200
git fetch origin "$TARGET_BRANCH" --deepen=200
elif [ ${BUILD_TYPE} == "continuous" ]; then
elif [[ ${BUILD_TYPE} == "continuous" ]]; then
# For continuous build, we want to know the difference in the last
# commit. This assumes we use squash commit when merging PRs.
GIT_DIFF_ARG="HEAD~.."
# Then fetch one last commit for getting the diff.
git fetch origin main --deepen=1
git fetch origin "$TARGET_BRANCH" --deepen=1
FETCH_DEPTH=""
if [[ ${BUILD_TYPE} == "presubmit" ]]; then
# For presubmit build, we want to know the difference from the
# common commit in the target branch.
GIT_DIFF_ARG="origin/$TARGET_BRANCH..."
FETCH_DEPTH=200
elif [[ ${BUILD_TYPE} == "continuous" ]]; then
# For continuous build, we want to know the difference in the last
# commit. This assumes we use squash commit when merging PRs.
GIT_DIFF_ARG="HEAD~.."
FETCH_DEPTH=1
fi
if [[ -n "${FETCH_DEPTH}" ]]; then
# Fetch enough history for getting the diff.
git fetch origin "$TARGET_BRANCH" --deepen="${FETCH_DEPTH}"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments