4
0

gen.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: codegen
  2. on: workflow_dispatch
  3. jobs:
  4. codegen:
  5. runs-on: ubuntu-20.04
  6. steps:
  7. - uses: actions/checkout@v2
  8. - uses: actions/checkout@v2
  9. with:
  10. repository: libbpf/libbpf
  11. path: libbpf
  12. - name: libbpf-version
  13. working-directory: libbpf
  14. run: echo "LIBBPF_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
  15. - uses: actions-rs/toolchain@v1
  16. with:
  17. profile: minimal
  18. toolchain: nightly
  19. components: rustfmt, clippy
  20. override: true
  21. - uses: Swatinem/rust-cache@v1
  22. - name: Install headers
  23. run: |
  24. sudo apt -y update
  25. sudo apt -y install libc6-dev libc6-dev-{arm64,armel,riscv64}-cross
  26. - name: Run codegen
  27. run: |
  28. cargo xtask codegen --libbpf-dir ./libbpf
  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