|
| 1 | +# Copyright 2025 Specter Ops, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | + |
| 17 | +name: Code Generation Check |
| 18 | + |
| 19 | +on: |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +jobs: |
| 23 | + code-generation-check: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout source code for this repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Install Go |
| 31 | + uses: actions/setup-go@v5 |
| 32 | + with: |
| 33 | + go-version-file: go.mod |
| 34 | + cache: true |
| 35 | + check-latest: true |
| 36 | + |
| 37 | + - name: Install Node |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: 22 |
| 41 | + |
| 42 | + - name: Install Yarn |
| 43 | + run: | |
| 44 | + npm install --global yarn |
| 45 | +
|
| 46 | + - name: Run stbernard deps |
| 47 | + run: | |
| 48 | + go tool stbernard deps |
| 49 | +
|
| 50 | + - name: Run stbernard modsync |
| 51 | + run: | |
| 52 | + go tool stbernard modsync |
| 53 | +
|
| 54 | + - name: Run stbernard generate |
| 55 | + run: | |
| 56 | + go tool stbernard generate |
| 57 | +
|
| 58 | + - name: Check for uncommitted changes |
| 59 | + id: show |
| 60 | + run: | |
| 61 | + go tool stbernard show |
| 62 | +
|
| 63 | + - name: Fail with helpful message |
| 64 | + if: failure() |
| 65 | + run: | |
| 66 | + echo "::error::Code generation check failed!" |
| 67 | + echo "" |
| 68 | + echo "==========================================" |
| 69 | + echo " CODE GENERATION CHECK FAILED" |
| 70 | + echo "==========================================" |
| 71 | + echo "" |
| 72 | + echo "This PR has uncommitted generated code or dependency changes." |
| 73 | + echo "" |
| 74 | + echo "Please run the following command locally and commit the changes:" |
| 75 | + echo "" |
| 76 | + echo " just prepare-for-codereview" |
| 77 | + echo "" |
| 78 | + echo "Then push the updated changes to this PR." |
| 79 | + echo "" |
| 80 | + echo "==========================================" |
| 81 | + exit 1 |
| 82 | +
|
0 commit comments