1
1
on :
2
2
pull_request :
3
- branches :
4
- - " **"
3
+ types : [opened, reopened, edited, synchronize]
5
4
6
5
name : Synchronize Bindings
7
6
8
7
concurrency :
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
12
8
group : ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
13
9
cancel-in-progress : true
14
10
15
11
jobs :
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
21
14
runs-on : ubuntu-latest
22
- if : github.event.pull_request.head.repo.full_name == github.repository
23
15
steps :
24
16
- name : Checkout
25
17
uses : actions/checkout@v4
26
- with :
27
- ref : ${{ github.head_ref || github.ref_name }}
28
18
- name : Rust Cache
29
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
30
19
31
20
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
33
21
save-if : ${{ github.ref == 'refs/heads/main' }}
34
22
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"
39
23
- name : Setup
40
24
run : |
41
25
cargo xtask init
42
26
- name : Generate Bindings
43
27
run : |
44
28
cargo xtask codegen
45
- - name : Check for changes
29
+ - name : Check for changes and create diff
46
30
id : check_changes
47
31
run : |
48
32
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"
50
39
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