1313 check-comment :
1414 runs-on : ubuntu-slim
1515 timeout-minutes : 10
16- if : ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/autoformat') }}
16+ if : github.event.issue.pull_request && startsWith(github.event.comment.body, '/autoformat')
1717 permissions :
1818 statuses : write # autoformat.createStatus
1919 pull-requests : write # autoformat.createReaction on PRs
2929 steps :
3030 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3131 with :
32+ persist-credentials : false
3233 sparse-checkout : |
3334 .github
3435 - name : judge
5051 return { ...pullInfo, shouldAutoformat };
5152
5253 - name : Check maintainer access
53- if : ${{ fromJSON(steps.judge.outputs.result).shouldAutoformat }}
54+ if : fromJSON(steps.judge.outputs.result).shouldAutoformat
5455 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
5556 with :
5657 retries : 3
@@ -62,14 +63,15 @@ jobs:
6263 runs-on : ubuntu-latest
6364 timeout-minutes : 30
6465 needs : check-comment
65- if : ${{ needs.check-comment.outputs.should_autoformat == 'true' }}
66+ if : needs.check-comment.outputs.should_autoformat == 'true'
6667 permissions :
6768 pull-requests : read # view files modified in PR
6869 outputs :
6970 reformatted : ${{ steps.patch.outputs.reformatted }}
7071 steps :
7172 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7273 with :
74+ persist-credentials : false
7375 repository : ${{ needs.check-comment.outputs.repository }}
7476 ref : ${{ needs.check-comment.outputs.head_ref }}
7577 # Set fetch-depth to merge the base branch
8789 id : diff
8890 env :
8991 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92+ REPO : ${{ github.repository }}
93+ PULL_NUMBER : ${{ needs.check-comment.outputs.pull_number }}
9094 run : |
91- changed_files="$(gh pr view --repo ${{ github.repository }} ${{ needs.check-comment.outputs.pull_number }} --json files --jq '.files.[].path')"
95+ changed_files="$(gh pr view --repo $REPO $PULL_NUMBER --json files --jq '.files.[].path')"
9296 protos=$([[ -z $(echo "$changed_files" | grep '^\(mlflow/protos\|tests/protos\)') ]] && echo "false" || echo "true")
9397 js=$([[ -z $(echo "$changed_files" | grep '^mlflow/server/js') ]] && echo "false" || echo "true")
9498 docs=$([[ -z $(echo "$changed_files" | grep '^docs/') ]] && echo "false" || echo "true")
@@ -103,13 +107,16 @@ jobs:
103107 echo "api=$api" >> $GITHUB_OUTPUT
104108 # Merge the base branch (which is usually master) to apply formatting using the latest configurations.
105109 - name : Merge base branch
110+ env :
111+ BASE_REPO : ${{ needs.check-comment.outputs.base_repo }}
112+ BASE_REF : ${{ needs.check-comment.outputs.base_ref }}
106113 run : |
107114 # This identity is only used for the temporary merge commit and is not pushed.
108115 git config user.name 'name'
109116 git config user.email 'email'
110- git remote add base https://github.com/${{ needs.check-comment.outputs.base_repo }} .git
111- git fetch base ${{ needs.check-comment.outputs.base_ref }}
112- git merge base/${{ needs.check-comment.outputs.base_ref }}
117+ git remote add base https://github.com/$BASE_REPO .git
118+ git fetch base $BASE_REF
119+ git merge base/$BASE_REF
113120 - uses : ./.github/actions/setup-python
114121 # ************************************************************************
115122 # pre-commit
@@ -144,7 +151,7 @@ jobs:
144151 - if : steps.diff.outputs.js == 'true'
145152 working-directory : mlflow/server/js
146153 run : |
147- yarn install
154+ yarn install --immutable
148155 - if : steps.diff.outputs.js == 'true'
149156 working-directory : mlflow/server/js
150157 run : |
@@ -174,16 +181,18 @@ jobs:
174181 # ************************************************************************
175182 - if : steps.diff.outputs.api == 'true'
176183 run : |
177- uv run --group docs --extra gateway --directory docs/api_reference make dummy
184+ uv run --group docs --group torch -- extra gateway --directory docs/api_reference make dummy
178185 # ************************************************************************
179186 # Upload patch
180187 # ************************************************************************
181188 - name : Create patch
182189 id : patch
190+ env :
191+ RUN_ID : ${{ github.run_id }}
183192 run : |
184193 git add -N .
185- git diff > ${{ github.run_id }} .diff
186- reformatted=$([[ -s ${{ github.run_id }} .diff ]] && echo "true" || echo "false")
194+ git diff > $RUN_ID .diff
195+ reformatted=$([[ -s $RUN_ID .diff ]] && echo "true" || echo "false")
187196 echo "reformatted=$reformatted" >> $GITHUB_OUTPUT
188197
189198 - name : Upload patch
@@ -196,13 +205,13 @@ jobs:
196205 runs-on : ubuntu-slim
197206 timeout-minutes : 5
198207 needs : [check-comment, format]
199- if : ${{ needs.format.outputs.reformatted == 'true' }}
208+ if : needs.format.outputs.reformatted == 'true'
200209 permissions :
201210 contents : read
202211 outputs :
203212 head_sha : ${{ steps.push.outputs.head_sha }}
204213 steps :
205- - uses : actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
214+ - uses : actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
206215 id : app-token
207216 with :
208217 app-id : ${{ secrets.APP_ID }}
@@ -211,6 +220,7 @@ jobs:
211220 private-key : ${{ secrets.APP_PRIVATE_KEY }}
212221 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
213222 with :
223+ persist-credentials : true
214224 repository : ${{ needs.check-comment.outputs.repository }}
215225 ref : ${{ needs.check-comment.outputs.head_ref }}
216226 # Set fetch-depth to merge the base branch
@@ -257,7 +267,7 @@ jobs:
257267 git merge base/${BASE_REF}
258268
259269 - name : Download patch
260- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
270+ uses : actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
261271 with :
262272 name : ${{ github.run_id }}.diff
263273 path : /tmp
@@ -285,17 +295,22 @@ jobs:
285295 steps :
286296 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
287297 with :
298+ persist-credentials : false
288299 sparse-checkout : |
289300 .github
290301 - name : Update status
291302 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
303+ env :
304+ NEEDS_JSON : ${{ toJson(needs) }}
305+ HEAD_SHA : ${{ needs.check-comment.outputs.head_sha }}
306+ PUSH_HEAD_SHA : ${{ needs.push.outputs.head_sha }}
292307 with :
293308 retries : 3
294309 script : |
295- const needs = ${{ toJson(needs) }} ;
296- const head_sha = '${{ needs.check-comment.outputs.head_sha }}'
310+ const needs = JSON.parse(process.env.NEEDS_JSON) ;
311+ const head_sha = process.env.HEAD_SHA;
297312 const autoformat = require('./.github/workflows/autoformat.js');
298- const push_head_sha = '${{ needs.push.outputs.head_sha }}' ;
313+ const push_head_sha = process.env.PUSH_HEAD_SHA ;
299314 if (push_head_sha) {
300315 await autoformat.approveWorkflowRuns(context, github, push_head_sha);
301316 }
0 commit comments