File tree 4 files changed +101
-16
lines changed
4 files changed +101
-16
lines changed Original file line number Diff line number Diff line change
1
+ mutation (
2
+ $githubRepository : String !
3
+ $branchName : String !
4
+ $expectedHeadOid : GitObjectID !
5
+ $commitMessage : String !
6
+ $files : [FileAddition ! ]!
7
+ ) {
8
+ createCommitOnBranch (
9
+ input : {
10
+ branch : {
11
+ repositoryNameWithOwner : $githubRepository
12
+ branchName : $branchName
13
+ }
14
+ message : { headline : $commitMessage }
15
+ fileChanges : { additions : $files }
16
+ expectedHeadOid : $expectedHeadOid
17
+ }
18
+ ) {
19
+ commit {
20
+ url
21
+ }
22
+ }
23
+ }
Original file line number Diff line number Diff line change @@ -26,15 +26,35 @@ jobs:
26
26
cargo run -p update-bindings -- -b -d arm-unknown-linux-gnueabi
27
27
28
28
- name : Push Changes
29
- shell : bash {0}
29
+ env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30
31
run : |
31
32
git config user.name "tauri"
32
33
git config user.email "[email protected] "
33
34
git add .
34
- git commit -m 'chore: update linux bindings'
35
- if [ $? -eq 0 ]; then
35
+
36
+ CHANGED=($(git diff --name-only --staged | xargs))
37
+ FILES=""
38
+ for value in ${CHANGED[@]}; do
39
+ base64 -w0 "${value}" > "${value}.base64"
40
+ FILES="${FILES} -F \"files[][path]=${value}\" -F \"files[][contents]=@${value}.base64\""
41
+ done
42
+
43
+ if [ "${FILES}" != "" ]; then
36
44
git switch -c update-linux
37
45
git push --force -u origin update-linux
38
- else
39
- echo "::debug::No changes to commit."
46
+ gh api graphql \
47
+ -F "githubRepository=${GIT_REPOSITORY}" \
48
+ -F "branchName=update-linux" \
49
+ -F "expectedHeadOid=$(git rev-parse HEAD)" \
50
+ -F "commitMessage=chore: update linux bindings" \
51
+ -F "[email protected] /api/createCommitOnBranch.graphql" \
52
+ ${FILES}
53
+
54
+ git restore --staged .
55
+ git restore .
56
+ git clean -f
57
+ git pull
58
+
59
+ gh pr create -f
40
60
fi
Original file line number Diff line number Diff line change @@ -20,15 +20,35 @@ jobs:
20
20
cargo run -p update-bindings -- -b -d x86_64-apple-darwin
21
21
22
22
- name : Push Changes
23
- shell : bash {0}
23
+ env :
24
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
24
25
run : |
25
26
git config user.name "tauri"
26
27
git config user.email "[email protected] "
27
28
git add .
28
- git commit -m 'chore: update macos bindings'
29
- if [ $? -eq 0 ]; then
29
+
30
+ CHANGED=($(git diff --name-only --staged | xargs))
31
+ FILES=""
32
+ for value in ${CHANGED[@]}; do
33
+ base64 "${value}" > "${value}.base64"
34
+ FILES="${FILES} -F \"files[][path]=${value}\" -F \"files[][contents]=@${value}.base64\""
35
+ done
36
+
37
+ if [ "${FILES}" != "" ]; then
30
38
git switch -c update-macos
31
39
git push --force -u origin update-macos
32
- else
33
- echo "::debug::No changes to commit."
40
+ gh api graphql \
41
+ -F "githubRepository=${GIT_REPOSITORY}" \
42
+ -F "branchName=update-macos" \
43
+ -F "expectedHeadOid=$(git rev-parse HEAD)" \
44
+ -F "commitMessage=chore: update macos bindings" \
45
+ -F "[email protected] /api/createCommitOnBranch.graphql" \
46
+ ${FILES}
47
+
48
+ git restore --staged .
49
+ git restore .
50
+ git clean -f
51
+ git pull
52
+
53
+ gh pr create -f
34
54
fi
Original file line number Diff line number Diff line change @@ -21,16 +21,38 @@ jobs:
21
21
cargo run -p update-bindings -- -b -d i686-pc-windows-msvc
22
22
23
23
- name : Push Changes
24
- shell : pwsh -File {0}
24
+ env :
25
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
26
run : |
26
27
git config user.name "tauri"
27
28
git config user.email "[email protected] "
28
29
git add .
29
- git commit -m 'chore: update windows bindings'
30
- if ($?) {
30
+
31
+ $changed = @(git diff --name-only --staged)
32
+ $files = ""
33
+ $changed | %{
34
+ $contents = [System.IO.File]::ReadAllBytes($_)
35
+ $base64Contents = [System.Convert]::ToBase64String($contents)
36
+ Set-Content -Path "$_.base64" -Value $base64Contents
37
+ $files += " -F `"files[][path]=$_`" -F `"files[][contents]=@$_.base64`""
38
+ }
39
+
40
+ if ($files -ne "") {
31
41
git switch -c update-windows
32
42
git push --force -u origin update-windows
33
- } else {
34
- echo "::debug::No changes to commit."
35
- $LASTEXITCODE = 0
43
+
44
+ gh api graphql `
45
+ -F "githubRepository=${env:GIT_REPOSITORY}" `
46
+ -F "branchName=update-windows" `
47
+ -F "expectedHeadOid=$(git rev-parse HEAD)" `
48
+ -F "commitMessage=chore: update windows bindings" `
49
+ -F "[email protected] /api/createCommitOnBranch.graphql" `
50
+ $files
51
+
52
+ git restore --staged .
53
+ git restore .
54
+ git clean -f
55
+ git pull
56
+
57
+ gh pr create -f
36
58
}
You can’t perform that action at this time.
0 commit comments