Skip to content

Commit

Permalink
Added sync src to commit msg in self-push step
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jan 11, 2025
1 parent a5a7898 commit 32c1e2f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/sync-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,22 @@ jobs:
ff_timestamp=$(git log -1 --format="%ct" -- "$ff_file" 2>/dev/null || echo 0)
chromium_timestamp=$(git log -1 --format="%ct" -- "$chromium_file" 2>/dev/null || echo 0)
# Get the latest commit timestamps for both files
ff_timestamp=$(git log -1 --format="%ct" -- "$ff_file" 2>/dev/null || echo 0)
chromium_timestamp=$(git log -1 --format="%ct" -- "$chromium_file" 2>/dev/null || echo 0)
# Sync the most recently updated messages.json to the other dir
if (( $ff_timestamp != $chromium_timestamp )) ; then
[[ "$locales_updated" != true ]] && locales_updated=true
if [[ $ff_timestamp -ne $chromium_timestamp ]] ; then
if (( $ff_timestamp > $chromium_timestamp )) ; then
cp -f "$ff_file" "$chromium_file"
else cp -f "$chromium_file" "$ff_file" ; fi
cp -f "$ff_file" "$chromium_file" ; sync_src="${ff_dir%%/*}"
else cp -f "$chromium_file" "$ff_file" ; sync_src="${chromium_dir%%/*}" ; fi
fi

fi
done
if [[ "$locales_updated" == true ]] ; then echo "LOCALES_UPDATED=true" >> $GITHUB_ENV ; fi

# Expose sync src for commit msg in self-push step
echo "SYNC_SRC=$sync_src" >> $GITHUB_ENV

- name: Sync ** to adamlui/ai-apps/phind-omnibox/
run: |
Expand All @@ -80,11 +85,10 @@ jobs:
git config --global user.signingkey "${{ secrets.GPG_PRIVATE_ID }}"
- name: Push changes to adamlui/phind-omnibox
if: env.LOCALES_UPDATED == 'true'
if: env.SYNC_SRC
run: |
cd ${{ github.workspace }}/adamlui/phind-omnibox
git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/phind-omnibox]" || true
git add . && git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from ${{ env.SYNC_SRC }}/]" || true
git push
- name: Push changes to adamlui/ai-apps
Expand Down

0 comments on commit 32c1e2f

Please sign in to comment.