-
Notifications
You must be signed in to change notification settings - Fork 1.6k
58 lines (56 loc) · 2.51 KB
/
Copy pathgeneration_check.yaml
File metadata and controls
58 lines (56 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
name: generation-check
on:
push:
branches:
- main
pull_request:
# Allows manual triggering for debugging purpose.
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
regeneration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: changes
with:
filters: |
librarian:
- 'librarian.yaml'
# Version of librarian is pulled from librarian.yaml,
# main corresponds to the action's source definition.
- uses: googleapis/librarian@main # zizmor: ignore[unpinned-uses]
if: steps.changes.outputs.librarian == 'true' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
with:
protoc-version: '33.2'
protoc-checksum: '8c0a8577311720cc83488f813aeb5046d69cb9824cbf39cb7447e0c5132d677952d5bb7c1130d9df381835eee7352828878d409873ebb407d7a4649ea2a4aee5'
- name: Install tools
if: steps.changes.outputs.librarian == 'true' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: librarian install
- name: Regenerate
if: steps.changes.outputs.librarian == 'true' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: |
librarian generate --all
if [ -n "$(git status --porcelain)" ]; then
git status
echo "==================== GIT DIFF ===================="
git diff
echo "=================================================="
echo "Regeneration failed. Please run 'librarian generate --all' to update the generated files."
exit 1
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 # zizmor: ignore[unpinned-uses]
with:
title: "Librarian generate diff check failed on main branch"
body: |
The librarian generate diff check failed on main branch.
To keep the `main` branch healthy, please consider **reverting the triggering change** first. Once the revert is merged, you can investigate the failure and submit a new PR with the fix.
Please check the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}