diff --git a/.github/workflows/codegen.yaml b/.github/workflows/codegen.yaml new file mode 100644 index 0000000..fa8d0c2 --- /dev/null +++ b/.github/workflows/codegen.yaml @@ -0,0 +1,32 @@ +name: Update codegen + +on: + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - 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 + else + echo "No changes to commit" + fi