Skip to content

Commit

Permalink
Added GitHub Action to build generated files and push them to the `ge…
Browse files Browse the repository at this point in the history
…nerated` branch.

PiperOrigin-RevId: 438583959
  • Loading branch information
haberman authored and copybara-github committed Mar 31, 2022
1 parent a5243ff commit f32e79a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/generate_files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Generate Files

# After any push to the main branch, re-generate pregenerated files.
on:
push:
branches:
- main

jobs:
generate:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Merge generated branch with main
run: cd ${{ github.workspace} && (git checkout generated || git checkout -b generated) && git merge --no-edit main
- name: Rebuild generated CMake files
run: cd ${{ github.workspace }} && bazel test cmake:test_generated_files || bazel-bin/cmake/test_generated_files --fix
- name: Commit and push changes to generated files
run: cd ${{ github.workspace }} && git add -A && git diff --staged --quiet || (git commit -am "Regenerated files" && git push)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
obj/
lib/
bazel-*
_build
.vscode

0 comments on commit f32e79a

Please sign in to comment.