Removed width=auto
from buttons to support GitLab
#172
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync _locales/ between brave-omnibox/<chromium|firefox>/extension/, then brave-omnibox/ to adamlui/brave-omnibox/ | |
on: | |
push: | |
branches: [main] | |
paths: [brave-omnibox/**] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
if: (github.repository == 'adamlui/ai-web-extensions') && (github.event.commits[0].committer.username != 'kudo-sync-bot') | |
runs-on: ubuntu-latest | |
env: | |
TZ: PST8PDT | |
steps: | |
- name: Checkout adamlui/ai-web-extensions | |
uses: actions/checkout@v5 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: adamlui/ai-web-extensions | |
path: adamlui/ai-web-extensions | |
fetch-depth: 2 | |
- name: Checkout adamlui/brave-omnibox | |
uses: actions/checkout@v5 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: adamlui/brave-omnibox | |
path: adamlui/brave-omnibox | |
- name: Sync _locales/ between brave-omnibox/<chromium|firefox>/extension/ | |
run: | | |
cd ${{ github.workspace }}/adamlui/ai-web-extensions/brave-omnibox | |
ff_dir="firefox/extension/_locales" | |
chromium_dir="chromium/extension/_locales" | |
# Loop thru all lang dirs in firefox | |
for locale in $(find "$ff_dir" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) ; do | |
ff_file="$ff_dir/$locale/messages.json" | |
chromium_file="$chromium_dir/$locale/messages.json" | |
if [[ -f "$ff_file" && -f "$chromium_file" ]] ; then | |
# 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 -ne $chromium_timestamp ]] ; then | |
if (( $ff_timestamp > $chromium_timestamp )) ; then | |
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 | |
# Expose sync src for commit msg in self-push step | |
echo "SYNC_SRC=$sync_src" >> $GITHUB_ENV | |
- name: Sync brave-omnibox/ to adamlui/brave-omnibox/ | |
run: | | |
rsync -avhr --delete --filter='P /.*' \ | |
${{ github.workspace }}/adamlui/ai-web-extensions/brave-omnibox/ \ | |
${{ github.workspace }}/adamlui/brave-omnibox/ | |
- name: Escape backticks in commit msg | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
echo "ESCAPED_MSG<<EOF" >> $GITHUB_ENV | |
echo "$COMMIT_MSG" | sed 's/`/\`/g' >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Config committer | |
run: | | |
gpg --batch --import <(echo "${{ secrets.GPG_PRIVATE_KEY }}") | |
git config --global commit.gpgsign true | |
git config --global user.name "kudo-sync-bot" | |
git config --global user.email "auto-sync@kudoai.com" | |
git config --global user.signingkey "${{ secrets.GPG_PRIVATE_ID }}" | |
- name: Push changes to adamlui/ai-web-extensions | |
if: env.SYNC_SRC | |
run: | | |
cd ${{ github.workspace }}/adamlui/ai-web-extensions | |
git pull # again to sync w/ concurrent workflow updates | |
git add . && git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from brave-omnibox/${{ env.SYNC_SRC }}]" || true | |
git push | |
- name: Push changes to adamlui/brave-omnibox | |
run: | | |
cd ${{ github.workspace }}/adamlui/brave-omnibox | |
git pull # again to sync w/ concurrent workflow updates | |
git add . && git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/brave-omnibox]" || true | |
git push |