11on :
22 pull_request :
3- branches :
4- - " **"
3+ types : [opened, reopened, edited, synchronize]
54
65name : Synchronize Bindings
76
87concurrency :
9- # Use github.run_id on main branch
10- # Use github.event.pull_request.number on pull requests, so it's unique per pull request
11- # Use github.ref on other branches, so it's unique per branch
128 group : ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
139 cancel-in-progress : true
1410
1511jobs :
16- generate_bindings :
17- name : Synchronise Bindings (Not Fork)
18- permissions :
19- contents : write
20- pull-requests : write
12+ generate_bindings :
13+ name : Generate Diff
2114 runs-on : ubuntu-latest
22- if : github.event.pull_request.head.repo.full_name == github.repository
2315 steps :
2416 - name : Checkout
2517 uses : actions/checkout@v4
26- with :
27- ref : ${{ github.head_ref || github.ref_name }}
2818 - name : Rust Cache
29- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
3019 uses : Swatinem/rust-cache@v2.7.7
3120 with :
32- # reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
3321 save-if : ${{ github.ref == 'refs/heads/main' }}
3422 cache-all-crates : true
35- - name : Setup Bot GitHub Credentials
36- run : |
37- git config user.name "github-actions[bot]"
38- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3923 - name : Setup
4024 run : |
4125 cargo xtask init
4226 - name : Generate Bindings
4327 run : |
4428 cargo xtask codegen
45- - name : Check for changes
29+ - name : Check for changes and create diff
4630 id : check_changes
4731 run : |
4832 if [[ -n $(git status --porcelain) ]]; then
49- echo "changes=true" >> "$GITHUB_OUTPUT";
33+ echo "changes=true" >> "$GITHUB_OUTPUT"
34+ git diff > bindings.diff
35+ echo "Diff created:"
36+ cat bindings.diff
37+ else
38+ echo "changes=false" >> "$GITHUB_OUTPUT"
5039 fi
51- - name : Commit Changes
52- if : steps.check_changes.outputs.changes
53- run : |
54- git add -A
55- git commit -m "chore(codegen): update bevy bindings"
56- git push
40+ - name : Upload Diff Artifact
41+ if : steps.check_changes.outputs.changes == 'true'
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : bindings.diff
45+ path : bindings.diff
46+ retention-days : 1
47+ - name : Upload GitHub Pull Request Event
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : event-bindings.json
51+ path : ${{ github.event_path }}
0 commit comments