From 83e40e27c3ea60e93f2221120d62d1ed9f45c3cd Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 6 May 2026 17:31:11 +0000 Subject: [PATCH] chore: fix librarian regeneration check There are two reasons we should create an issue: - Regeneration failed - Regeneration succeeded, but created a diff The previous implementation was half of one, half of the other. This separates out the two cases, creating an appropriate issue in each case. Fixes https://github.com/googleapis/librarian/issues/5866 --- .github/workflows/regenerate-all.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regenerate-all.yml b/.github/workflows/regenerate-all.yml index f47592a82d88..1cc79a531cbc 100644 --- a/.github/workflows/regenerate-all.yml +++ b/.github/workflows/regenerate-all.yml @@ -48,7 +48,6 @@ jobs: go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -all -v - name: Create issue on diff - if: failure() env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -70,4 +69,19 @@ jobs: echo "Issue #$EXISTING_ISSUE already exists, adding a comment." gh issue comment "$EXISTING_ISSUE" --body "Another failure with diff occurred: $RUN_URL" fi - fi \ No newline at end of file + fi + - name: Create issue on generation failure + if: failure() + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TITLE="Regeneration failed" + RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + BODY="The post-submit [regeneration check]($RUN_URL) failed." + EXISTING_ISSUE=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number') + if [ -z "$EXISTING_ISSUE" ]; then + gh issue create --title "$TITLE" --body "$BODY" + else + echo "Issue #$EXISTING_ISSUE already exists, adding a comment." + gh issue comment "$EXISTING_ISSUE" --body "Another regeneration failure occurred: $RUN_URL" + fi