gen.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: codegen
  2. on: workflow_dispatch
  3. jobs:
  4. codegen:
  5. runs-on: ubuntu-20.04
  6. steps:
  7. - uses: actions/checkout@v4
  8. with:
  9. submodules: recursive
  10. - name: update libbpf
  11. working-directory: xtask/libbpf
  12. run: |
  13. set -e
  14. git fetch origin
  15. git checkout origin/HEAD
  16. echo "LIBBPF_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
  17. - uses: dtolnay/rust-toolchain@master
  18. with:
  19. toolchain: nightly
  20. components: rustfmt, clippy
  21. - uses: Swatinem/rust-cache@v2
  22. - name: Install headers
  23. run: |
  24. sudo apt -y update
  25. sudo apt -y install libelf-dev libc6-dev libc6-dev-{arm64,armel,riscv64,ppc64el,s390x}-cross
  26. - name: Run codegen
  27. run: |
  28. cargo xtask codegen
  29. - name: Check for changes
  30. run: |
  31. git diff --quiet || echo "COMMIT_CHANGES=1" >> $GITHUB_ENV
  32. - name: Commit Changes
  33. id: commit
  34. if: env.COMMIT_CHANGES == 1
  35. uses: devops-infra/action-commit-push@master
  36. with:
  37. github_token: "${{ secrets.CRABBY_GITHUB_TOKEN }}"
  38. commit_prefix: "[codegen] Update libbpf to ${{ env.LIBBPF_SHA }}"
  39. commit_message: "Update libbpf to ${{ env.LIBBPF_SHA }}"
  40. target_branch: codegen
  41. force: true
  42. - name: Create pull request
  43. if: steps.commit.outputs.files_changed != ''
  44. uses: devops-infra/action-pull-request@master
  45. with:
  46. github_token: ${{ secrets.CRABBY_GITHUB_TOKEN }}
  47. body: "**Automated pull request**<br><br>Update libbpf to ${{ env.LIBBPF_SHA }}"
  48. title: Update libbpf to ${{ env.LIBBPF_SHA }}
  49. source_branch: codegen
  50. target_branch: main
  51. get_diff: true