1
0
Fork 0
mirror of https://github.com/imjasonh/snoop synced 2026-07-10 09:32:48 +00:00
snoop/.github/workflows/codegen.yaml
Jason Hall f40990236b fail when codegen mismatches
Signed-off-by: Jason Hall <jason@chainguard.dev>
2026-01-14 15:59:07 -05:00

41 lines
1.1 KiB
YAML

name: Update codegen
on:
pull_request:
branches: [main]
permissions: {}
jobs:
codegen:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
- run: |
sudo apt-get update
sudo apt-get install -y clang llvm libbpf-dev linux-headers-generic
- run: |
sudo bpftool btf dump file /sys/kernel/btf/vmlinux format c > pkg/ebpf/bpf/vmlinux.h
go generate ./pkg/ebpf/bpf
# Check for changes. Commit and push them.
- run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update generated code"
git push
exit 1 # Workflow should fail, so the PR author reviews the changes
else
echo "No changes to commit"
fi