Skip to content

Commit 4da088c

Browse files
committed
test sfor CI
1 parent f4ac0d5 commit 4da088c

File tree

3 files changed

+77
-16
lines changed

3 files changed

+77
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Build and Release
22

33
on:
44
push:

.github/workflows/sync-mlx.yml

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
echo "update_needed=true" >> "$GITHUB_OUTPUT"
4545
fi
4646
47+
- name: Prepare update branch
48+
if: steps.mlx.outputs.update_needed == 'true'
49+
env:
50+
BRANCH: chore/sync-mlx-${{ steps.mlx.outputs.latest_version }}
51+
run: git checkout -B "$BRANCH"
52+
4753
- name: Update MLX submodule
4854
if: steps.mlx.outputs.update_needed == 'true'
4955
run: |
@@ -74,31 +80,86 @@ jobs:
7480
props_path.write_text(text)
7581
PY
7682
git add Directory.Build.props
77-
- name: Setup .NET
83+
84+
- name: Commit changes
7885
if: steps.mlx.outputs.update_needed == 'true'
86+
id: commit
87+
env:
88+
TAG: ${{ steps.mlx.outputs.latest_tag }}
89+
run: |
90+
if git diff --cached --quiet; then
91+
echo "No staged changes to commit"
92+
echo "changed=false" >> "$GITHUB_OUTPUT"
93+
exit 0
94+
fi
95+
git config user.name "github-actions[bot]"
96+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
97+
git commit -m "chore: sync MLX to ${TAG}"
98+
echo "changed=true" >> "$GITHUB_OUTPUT"
99+
100+
- name: Setup .NET
101+
if: steps.commit.outputs.changed == 'true'
79102
uses: actions/setup-dotnet@v4
80103
with:
81104
dotnet-version: 9.0.x
82105

83106
- name: Build solution
84-
if: steps.mlx.outputs.update_needed == 'true'
107+
if: steps.commit.outputs.changed == 'true'
85108
run: |
86109
dotnet restore
87110
dotnet build --configuration Release --no-restore
88111
89-
- name: Prepare PR
90-
if: steps.mlx.outputs.update_needed == 'true'
112+
- name: Push changes
113+
if: steps.commit.outputs.changed == 'true'
114+
env:
115+
BRANCH: chore/sync-mlx-${{ steps.mlx.outputs.latest_version }}
91116
run: |
92-
git status -s
117+
git push --force --set-upstream origin "$BRANCH"
93118
94-
- name: Create pull request
95-
if: steps.mlx.outputs.update_needed == 'true'
96-
uses: peter-evans/create-pull-request@v6
97-
with:
98-
branch: "chore/sync-mlx-${{ steps.mlx.outputs.latest_version }}"
99-
commit-message: "chore: sync MLX to ${{ steps.mlx.outputs.latest_tag }}"
100-
title: "chore: sync MLX to ${{ steps.mlx.outputs.latest_tag }}"
101-
body: |
119+
- name: Create or update pull request
120+
if: steps.commit.outputs.changed == 'true'
121+
uses: actions/github-script@v7
122+
env:
123+
BRANCH: chore/sync-mlx-${{ steps.mlx.outputs.latest_version }}
124+
PR_TITLE: chore: sync MLX to ${{ steps.mlx.outputs.latest_tag }}
125+
PR_BODY: |
102126
- Update `extern/mlx` submodule to `${{ steps.mlx.outputs.latest_tag }}`
103127
- Align package version fields to `${{ steps.mlx.outputs.latest_version }}`
104-
signoff: false
128+
with:
129+
github-token: ${{ secrets.GITHUB_TOKEN }}
130+
script: |
131+
const branch = process.env.BRANCH;
132+
const title = process.env.PR_TITLE;
133+
const body = process.env.PR_BODY;
134+
const owner = context.repo.owner;
135+
const repo = context.repo.repo;
136+
const base = context.payload.repository.default_branch;
137+
138+
const { data: existing } = await github.rest.pulls.list({
139+
owner,
140+
repo,
141+
state: 'open',
142+
head: `${owner}:${branch}`,
143+
});
144+
145+
if (existing.length > 0) {
146+
const pr = existing[0];
147+
await github.rest.pulls.update({
148+
owner,
149+
repo,
150+
pull_number: pr.number,
151+
title,
152+
body,
153+
});
154+
core.info(`Updated PR ${pr.html_url}`);
155+
} else {
156+
const { data: pr } = await github.rest.pulls.create({
157+
owner,
158+
repo,
159+
head: branch,
160+
base,
161+
title,
162+
body,
163+
});
164+
core.info(`Created PR ${pr.html_url}`);
165+
}

extern/mlx

Submodule mlx updated 251 files

0 commit comments

Comments
 (0)