@@ -184,16 +184,13 @@ jobs:
184184 fi
185185 fi
186186
187- - name : Stage changes for later commit
187+ - name : Prepare changes for commit
188188 if : (steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true') && github.event_name == 'pull_request'
189189 run : |
190- # Just stage the files, don't commit yet
191- git add "${{ matrix.spec }}"
192-
193- # Create a summary file for the commit job to use
190+ # Create artifact directory with both metadata and the actual changed file
194191 SERVER_NAME="${{ steps.server-info.outputs.server-name }}"
195192 mkdir -p /tmp/commit-info
196-
193+
197194 if [ "${{ steps.update.outputs.changed }}" = "true" ]; then
198195 echo "update" > "/tmp/commit-info/${SERVER_NAME}.type"
199196 echo "$SERVER_NAME" > "/tmp/commit-info/${SERVER_NAME}.name"
@@ -203,7 +200,10 @@ jobs:
203200 echo "$SERVER_NAME" > "/tmp/commit-info/${SERVER_NAME}.name"
204201 echo "${{ matrix.spec }}" > "/tmp/commit-info/${SERVER_NAME}.spec"
205202 fi
206-
203+
204+ # Copy the modified spec file to the artifact directory
205+ cp "${{ matrix.spec }}" "/tmp/commit-info/${SERVER_NAME}.spec.yaml"
206+
207207 - name : Upload commit info
208208 if : (steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true') && github.event_name == 'pull_request'
209209 uses : actions/upload-artifact@v4
@@ -281,44 +281,49 @@ jobs:
281281 run : |
282282 git config --local user.email "[email protected] " 283283 git config --local user.name "GitHub Action"
284-
284+
285285 # Pull any remote changes first to avoid conflicts
286286 git pull origin ${{ github.head_ref || github.ref_name }} --rebase
287-
287+
288288 # Collect all the server names that were updated
289289 UPDATED_SERVERS=""
290290 WARNING_SERVERS=""
291-
291+
292292 for file in /tmp/artifacts/*.type; do
293293 if [ -f "$file" ]; then
294294 SERVER_NAME=$(basename "$file" .type)
295295 TYPE=$(cat "$file")
296-
296+
297297 if [ "$TYPE" = "update" ]; then
298298 UPDATED_SERVERS="$UPDATED_SERVERS $SERVER_NAME"
299299 else
300300 WARNING_SERVERS="$WARNING_SERVERS $SERVER_NAME"
301301 fi
302-
303- # Stage the corresponding spec file
302+
303+ # Restore the modified spec file from the artifact
304304 SPEC_FILE=$(cat "/tmp/artifacts/${SERVER_NAME}.spec")
305- git add "$SPEC_FILE"
305+ if [ -f "/tmp/artifacts/${SERVER_NAME}.spec.yaml" ]; then
306+ cp "/tmp/artifacts/${SERVER_NAME}.spec.yaml" "$SPEC_FILE"
307+ git add "$SPEC_FILE"
308+ else
309+ echo "Warning: Modified spec file not found in artifacts for $SERVER_NAME"
310+ fi
306311 fi
307312 done
308-
313+
309314 # Create commit message
310315 COMMIT_MSG="chore: update tool lists for MCP servers"
311-
316+
312317 if [ -n "$UPDATED_SERVERS" ]; then
313318 COMMIT_MSG="$COMMIT_MSG\n\nUpdated servers:$(echo $UPDATED_SERVERS | sed 's/ /\\n- /g' | sed 's/^/\\n- /')"
314319 fi
315-
320+
316321 if [ -n "$WARNING_SERVERS" ]; then
317322 COMMIT_MSG="$COMMIT_MSG\n\nWarning added for servers:$(echo $WARNING_SERVERS | sed 's/ /\\n- /g' | sed 's/^/\\n- /')"
318323 fi
319-
324+
320325 COMMIT_MSG="$COMMIT_MSG\n\nAutomatically updated using 'thv mcp list' command.\n\nCo-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
321-
326+
322327 # Check if there are actually any changes to commit
323328 if ! git diff --cached --quiet; then
324329 git commit -m "$COMMIT_MSG"
0 commit comments