Verify #381
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Verify | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| verify: | |
| name: Verify Codegen | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone the code | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run Codegen | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: make update-codegen | |
| - name: Verify | |
| shell: bash | |
| run: | | |
| # URL encode function for GitHub Actions annotations | |
| # From: https://backreference.org/2009/12/23/how-to-match-newlines-in-sed/ | |
| function urlencode() { | |
| sed ':begin;$!N;s/\n/%0A/;tbegin' | |
| } | |
| if [[ -z "$(git status --porcelain)" ]]; then | |
| echo "${{ github.repository }} up to date." | |
| else | |
| echo "Found diffs in: $(git diff-index --name-only HEAD --)" | |
| for x in $(git diff-index --name-only HEAD --); do | |
| echo "::error file=$x::Please run 'make update-codegen'.%0A$(git diff $x | urlencode)" | |
| done | |
| echo "Generated code is out of date. Please run 'make update-codegen' and commit the changes." | |
| exit 1 | |
| fi |