@@ -233,26 +233,43 @@ jobs:
233233 vars.SCHEDULED_SYNC != 'false' && github.repository_owner != 'LoopKit' && needs.check_latest_from_upstream.outputs.ABORT_SYNC == 'false'
234234 id : sync
235235 run : |
236- # First try the standard fork sync action
237- set +e
238- echo "Attempting standard fork sync..."
236+ set -e
237+ echo "Starting upstream sync process..."
239238
240- # Use the fork sync action first
241- gh extension install aormsby/gh-fork-sync || echo "Extension already installed"
239+ # Try to install gh-fork-sync extension if not already installed
240+ if ! gh extension list | grep -q "aormsby/gh-fork-sync"; then
241+ echo "Installing gh-fork-sync extension..."
242+ gh extension install aormsby/gh-fork-sync || echo "Failed to install extension"
243+ fi
242244
243- # Try fork sync with the action approach first
244- sync_result=0
245+ # Try gh-fork-sync first if available
246+ if gh extension list | grep -q "aormsby/gh-fork-sync"; then
247+ echo "Using gh-fork-sync extension..."
248+ set +e
249+ gh fork-sync --upstream "$UPSTREAM_REPO" --branch "$TARGET_BRANCH"
250+ sync_result=$?
251+ set -e
252+
253+ if [ $sync_result -eq 0 ]; then
254+ echo "Fork sync completed successfully"
255+ echo "has_new_commits=true" >> $GITHUB_OUTPUT
256+ exit 0
257+ else
258+ echo "Fork sync failed, falling back to custom script..."
259+ fi
260+ else
261+ echo "gh-fork-sync not available, using custom script..."
262+ fi
245263
246- # If the action approach fails, use our custom script
247- echo "Using custom sync script to handle potential conflicts..."
264+ # Use our custom script as fallback or primary method
265+ echo "Using custom sync script to handle merge conflicts..."
248266 bash ./Scripts/sync_with_upstream.sh
249267 sync_result=$?
250268
251269 if [ $sync_result -eq 0 ]; then
252- echo "Sync completed successfully"
253- echo "has_new_commits=true" >> $GITHUB_OUTPUT
270+ echo "Custom sync completed successfully"
254271 else
255- echo "Sync failed"
272+ echo "Custom sync failed"
256273 exit 1
257274 fi
258275 env :
0 commit comments