@@ -17,6 +17,7 @@ name: Check and Lint - bevy_mod_scripting
17
17
env :
18
18
REGISTRY : ghcr.io
19
19
IMAGE_NAME : bevy-mod-scripting
20
+ CODEGEN_BRANCH_NAME : __update-bevy-bindings-${{ github.head_ref || github.ref_name }}
20
21
21
22
concurrency :
22
23
# Use github.run_id on main branch
@@ -99,4 +100,48 @@ jobs:
99
100
if [[ -n $(git status -s) ]]; then
100
101
git commit -m "chore(badge): Update coverage badge" -m "[skip ci]"
101
102
git push
102
- fi
103
+ fi
104
+ generate_bindings :
105
+ name : Bindings - Synchronise
106
+ permissions :
107
+ contents : write
108
+ pull-requests : write
109
+ runs-on : ubuntu-latest
110
+ steps :
111
+ - name : Checkout
112
+ uses : actions/checkout@v4
113
+ - name : Setup Bot GitHub Credentials
114
+ run : |
115
+ git config user.name "github-actions[bot]"
116
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
117
+ - name : Setup
118
+ run : |
119
+ cargo xtask init
120
+ - name : Generate Bindings
121
+ run : |
122
+ cargo xtask codegen
123
+ - name : Check for changes
124
+ id : check_changes
125
+ run : |
126
+ if [[ -n $(git status --porcelain) ]]; then
127
+ echo "changes=true" >> "$GITHUB_OUTPUT";
128
+ fi
129
+ - name : Commit Changes
130
+ if : steps.check_changes.outputs.changes
131
+ run : |
132
+ git checkout -b ${{ env.CODEGEN_BRANCH_NAME }} || git checkout ${{ env.CODEGEN_BRANCH_NAME }}
133
+ git add -A
134
+ git commit -m "chore(codegen): update bevy bindings"
135
+ git push -u origin ${{ env.CODEGEN_BRANCH_NAME }} --force
136
+ - uses : jwalton/gh-find-current-pr@master
137
+ if : steps.check_changes.outputs.changes
138
+ id : findPR
139
+ with :
140
+ state : all
141
+ - name : Create Or Update PR
142
+ if : steps.check_changes.outputs.changes && success() && steps.findPR.outputs.number
143
+ run : |
144
+ gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json
145
+ if [ $(jq '. | length' prs.json) -eq 0 ]; then
146
+ gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings for #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true
147
+ fi
0 commit comments