Skip to content

Commit 30c8bf3

Browse files
authored
Merge pull request #3 from abmeks/copilot/fix-b624f009-c218-4524-a206-4233282d6ae5
[WIP] this is still an issue 403ef77 Merge pull request LoopKit#303 from LoopKit/hotfix/3.6.4 7d15e1b shift build action time to hh:33 ae49141 Bump main version to 3....
2 parents 439be10 + 224dd61 commit 30c8bf3

2 files changed

Lines changed: 35 additions & 14 deletions

File tree

.github/workflows/build_loop.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

Scripts/sync_with_upstream.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ fi
7171

7272
# Attempt merge with upstream
7373
echo -e "${YELLOW}Attempting to merge upstream changes${NC}"
74-
if git merge "upstream/$UPSTREAM_BRANCH" --no-edit; then
74+
if git merge "upstream/$UPSTREAM_BRANCH" --no-edit --allow-unrelated-histories; then
7575
echo -e "${GREEN}Successfully merged upstream changes without conflicts${NC}"
7676
echo -e "${GREEN}Pushing changes to origin${NC}"
77-
git push origin "$TARGET_BRANCH"
77+
if [ "$GH_PAT" = "dummy" ]; then
78+
echo -e "${YELLOW}Skipping push (dummy PAT provided)${NC}"
79+
else
80+
git push origin "$TARGET_BRANCH"
81+
fi
7882
exit 0
7983
fi
8084

0 commit comments

Comments
 (0)