Skip to content
Open
Changes from all commits
Commits
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
56 changes: 20 additions & 36 deletions .github/workflows/regenerate-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,28 @@ jobs:
run: |
PATH=$PATH:/tmp/pandoc/bin
librarian generate -all -v
git diff --exit-code

- name: Create issue on diff
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for generated code changes
run: |
if [ -n "$(git status --porcelain)" ]; then
TITLE="Regeneration check found diff"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
DIFF_STAT=$(git diff --stat)
BODY="The post-submit [regeneration check]($RUN_URL) found a diff.
git status
echo "==================== GIT DIFF ===================="
git diff
echo "=================================================="
echo "Regeneration produced code changes! Please run 'librarian generate -all -v' to update the generated files."
exit 1
fi

Diff summary:
\`\`\`
$DIFF_STAT
\`\`\`"
- name: Create issue if previous step fails
if: ${{ failure() }}
uses: googleapis/librarian/.github/actions/create-issue-on-failure@main
with:
title: "Regeneration failed"
body: |
The post-submit [regeneration check](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) 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 failure with diff occurred: $RUN_URL"
fi
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
Please investigate the failure. To keep the `main` branch healthy, please consider **reverting the triggering change** first.

You can identify the cause from the workflow logs:
- If the step 'Check for generated code changes' failed, there are pending code changes that need to be committed.
- If the step 'Regenerate' failed, the generation script itself encountered an error.
Loading