Skip to content

Commit 7b2983b

Browse files
authored
chore: fix librarian regeneration check (googleapis#16968)
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 googleapis/librarian#5866
1 parent 2dedaac commit 7b2983b

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/regenerate-all.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -all -v
4949
5050
- name: Create issue on diff
51-
if: failure()
5251
env:
5352
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5453
run: |
@@ -70,4 +69,19 @@ jobs:
7069
echo "Issue #$EXISTING_ISSUE already exists, adding a comment."
7170
gh issue comment "$EXISTING_ISSUE" --body "Another failure with diff occurred: $RUN_URL"
7271
fi
73-
fi
72+
fi
73+
- name: Create issue on generation failure
74+
if: failure()
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
TITLE="Regeneration failed"
79+
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
80+
BODY="The post-submit [regeneration check]($RUN_URL) failed."
81+
EXISTING_ISSUE=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number')
82+
if [ -z "$EXISTING_ISSUE" ]; then
83+
gh issue create --title "$TITLE" --body "$BODY"
84+
else
85+
echo "Issue #$EXISTING_ISSUE already exists, adding a comment."
86+
gh issue comment "$EXISTING_ISSUE" --body "Another regeneration failure occurred: $RUN_URL"
87+
fi

0 commit comments

Comments
 (0)