From 2512845bf3bb2fd4d2a308efabc9c5f151346afd Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 29 May 2026 19:40:05 +0000 Subject: [PATCH 1/6] chore: change to post submit and create an issue on failure --- .../workflows/librarian_generation_check.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index e6a8d31d9a35..518d3cf59886 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -11,13 +11,19 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -name: Librarian generate diff check on pull requests +name: Librarian generate diff check on: - pull_request: + push: + branches: + - main + workflow_dispatch: jobs: library_generation: runs-on: ubuntu-24.04 + permissions: + contents: read + issues: write steps: - uses: actions/checkout@v4 with: @@ -66,3 +72,11 @@ jobs: - name: Check for generated code changes run: | git diff --exit-code + - name: Create issue if previous step fails + if: ${{ failure() }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh issue create \ + --title "Librarian generate diff check failed on main branch" \ + --body "The librarian generate diff check failed on main branch. Please check the logs: https://github.com/googleapis/google-cloud-java/actions/runs/${GITHUB_RUN_ID}" From e0d914649fe99a3b07d962d93b8b3814c3882bc1 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 10 Jun 2026 15:48:14 -0400 Subject: [PATCH 2/6] fix merge issue --- .github/workflows/librarian_generation_check.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index 5e433619d652..4b46f499bfa6 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -11,11 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -<<<<<<< HEAD -name: Librarian generate diff check -======= name: Librarian - Generate diff check on pull requests ->>>>>>> main on: push: branches: @@ -79,7 +75,8 @@ jobs: git status echo "Regeneration produced code changes! Please run 'librarian generate --all' to update the generated files." exit 1 - fi - name: Create issue if previous step fails + fi + - name: Create issue if previous step fails if: ${{ failure() }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 177065f332336bfddaa64d76deac7e39ae077027 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 10 Jun 2026 15:58:11 -0400 Subject: [PATCH 3/6] use librarian action to create issue on failure --- .github/workflows/librarian_generation_check.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index 4b46f499bfa6..4fee94c6dc78 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -77,10 +77,11 @@ jobs: exit 1 fi - name: Create issue if previous step fails - if: ${{ failure() }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh issue create \ - --title "Librarian generate diff check failed on main branch" \ - --body "The librarian generate diff check failed on main branch. Please check the logs: https://github.com/googleapis/google-cloud-java/actions/runs/${GITHUB_RUN_ID}" + if: ${{ failure() && github.ref == 'refs/heads/main' }} + uses: googleapis/librarian/.github/actions/create-issue-on-failure@main + with: + title: "Librarian generate diff check failed on main branch" + body: | + The librarian generate diff check failed on main branch. + + Please check the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} From 2a20071342a8b640fae2a8efaac1df77d94edcfb Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 10 Jun 2026 16:03:23 -0400 Subject: [PATCH 4/6] temp: test workflow with forced failure --- .../workflows/librarian_generation_check.yaml | 75 ++++++++++--------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index 4fee94c6dc78..a669b1c9d1dd 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -16,6 +16,7 @@ on: push: branches: - main + - changePreToPost-2 workflow_dispatch: jobs: @@ -36,39 +37,43 @@ jobs: V=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version) echo "Installing librarian version $V" go install github.com/googleapis/librarian/cmd/librarian@$V - - name: Install protoc + # - name: Install protoc + # run: | + # set -e + # VERSION="33.2" + # curl -fsSL --retry 5 --retry-delay 15 -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip" + # cd /usr/local + # sudo unzip -o /tmp/protoc.zip + # protoc --version + # - uses: actions/setup-java@v4 + # with: + # java-version: "17" + # distribution: "temurin" + # cache: "maven" + # - name: Verify Java and Maven installation + # run: | + # java -version + # if ! command -v mvn &> /dev/null; then + # sudo apt-get update && sudo apt-get install -y maven + # fi + # mvn -version + # - uses: actions/setup-python@v5 + # with: + # python-version: "3.12" + # cache: 'pip' + # - name: Run librarian install + # run: | + # librarian install + # echo "$HOME/java_tools/bin" >> $GITHUB_PATH + # - name: Run librarian generate + # env: + # PYTHONPATH: ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot + # run: | + # librarian generate --all + - name: Force failure for testing run: | - set -e - VERSION="33.2" - curl -fsSL --retry 5 --retry-delay 15 -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip" - cd /usr/local - sudo unzip -o /tmp/protoc.zip - protoc --version - - uses: actions/setup-java@v4 - with: - java-version: "17" - distribution: "temurin" - cache: "maven" - - name: Verify Java and Maven installation - run: | - java -version - if ! command -v mvn &> /dev/null; then - sudo apt-get update && sudo apt-get install -y maven - fi - mvn -version - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - cache: 'pip' - - name: Run librarian install - run: | - librarian install - echo "$HOME/java_tools/bin" >> $GITHUB_PATH - - name: Run librarian generate - env: - PYTHONPATH: ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot - run: | - librarian generate --all + echo "Simulating failure for testing" + exit 1 - name: Check for generated code changes run: | if [ -n "$(git status --porcelain)" ]; then @@ -77,11 +82,11 @@ jobs: exit 1 fi - name: Create issue if previous step fails - if: ${{ failure() && github.ref == 'refs/heads/main' }} + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/changePreToPost-2') }} uses: googleapis/librarian/.github/actions/create-issue-on-failure@main with: - title: "Librarian generate diff check failed on main branch" + title: "TEMP: Librarian generate diff check failed on test branch" body: | - The librarian generate diff check failed on main branch. + This is a test issue to verify the 'create-issue-on-failure' action. Please check the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} From 5aa17792ddb86f400e0e1453ed4cad1e2f085771 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 10 Jun 2026 16:18:49 -0400 Subject: [PATCH 5/6] Revert "temp: test workflow with forced failure" This reverts commit 2a20071342a8b640fae2a8efaac1df77d94edcfb. --- .../workflows/librarian_generation_check.yaml | 75 +++++++++---------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index a669b1c9d1dd..4fee94c6dc78 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -16,7 +16,6 @@ on: push: branches: - main - - changePreToPost-2 workflow_dispatch: jobs: @@ -37,43 +36,39 @@ jobs: V=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version) echo "Installing librarian version $V" go install github.com/googleapis/librarian/cmd/librarian@$V - # - name: Install protoc - # run: | - # set -e - # VERSION="33.2" - # curl -fsSL --retry 5 --retry-delay 15 -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip" - # cd /usr/local - # sudo unzip -o /tmp/protoc.zip - # protoc --version - # - uses: actions/setup-java@v4 - # with: - # java-version: "17" - # distribution: "temurin" - # cache: "maven" - # - name: Verify Java and Maven installation - # run: | - # java -version - # if ! command -v mvn &> /dev/null; then - # sudo apt-get update && sudo apt-get install -y maven - # fi - # mvn -version - # - uses: actions/setup-python@v5 - # with: - # python-version: "3.12" - # cache: 'pip' - # - name: Run librarian install - # run: | - # librarian install - # echo "$HOME/java_tools/bin" >> $GITHUB_PATH - # - name: Run librarian generate - # env: - # PYTHONPATH: ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot - # run: | - # librarian generate --all - - name: Force failure for testing + - name: Install protoc run: | - echo "Simulating failure for testing" - exit 1 + set -e + VERSION="33.2" + curl -fsSL --retry 5 --retry-delay 15 -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip" + cd /usr/local + sudo unzip -o /tmp/protoc.zip + protoc --version + - uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "temurin" + cache: "maven" + - name: Verify Java and Maven installation + run: | + java -version + if ! command -v mvn &> /dev/null; then + sudo apt-get update && sudo apt-get install -y maven + fi + mvn -version + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + - name: Run librarian install + run: | + librarian install + echo "$HOME/java_tools/bin" >> $GITHUB_PATH + - name: Run librarian generate + env: + PYTHONPATH: ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot + run: | + librarian generate --all - name: Check for generated code changes run: | if [ -n "$(git status --porcelain)" ]; then @@ -82,11 +77,11 @@ jobs: exit 1 fi - name: Create issue if previous step fails - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/changePreToPost-2') }} + if: ${{ failure() && github.ref == 'refs/heads/main' }} uses: googleapis/librarian/.github/actions/create-issue-on-failure@main with: - title: "TEMP: Librarian generate diff check failed on test branch" + title: "Librarian generate diff check failed on main branch" body: | - This is a test issue to verify the 'create-issue-on-failure' action. + The librarian generate diff check failed on main branch. Please check the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} From 4ae354ad0697d8263a005a7bcc718e1a16196030 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 10 Jun 2026 16:22:36 -0400 Subject: [PATCH 6/6] rm extra whitespace --- .github/workflows/librarian_generation_check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/librarian_generation_check.yaml b/.github/workflows/librarian_generation_check.yaml index 4fee94c6dc78..d285b58de898 100644 --- a/.github/workflows/librarian_generation_check.yaml +++ b/.github/workflows/librarian_generation_check.yaml @@ -75,7 +75,7 @@ jobs: git status echo "Regeneration produced code changes! Please run 'librarian generate --all' to update the generated files." exit 1 - fi + fi - name: Create issue if previous step fails if: ${{ failure() && github.ref == 'refs/heads/main' }} uses: googleapis/librarian/.github/actions/create-issue-on-failure@main