Skip to content

Raised perplexity.ai tooltips in Brave ↞ [auto-sync from `adamlui/cha… #514

Raised perplexity.ai tooltips in Brave ↞ [auto-sync from `adamlui/cha…

Raised perplexity.ai tooltips in Brave ↞ [auto-sync from `adamlui/cha… #514

name: Sync LICENSE.md from edge/* to <platform>/*, then edge/extension/* to (chrome|opera)/extension/*, then edge/extension/_locales/* to greasemonkey/_locales/*, then ./* to adamlui/chatgpt-apps/chatgpt-widescreen/*, then greasemonkey/* to adamlui/userscripts/chatgpt/chatgpt-widescreen/*
on:
push:
branches: [main]
paths: [edge/**]
jobs:
build:
if: (github.repository == 'adamlui/chatgpt-widescreen') && (github.event.commits[0].committer.username != 'kudo-sync-bot')
runs-on: ubuntu-latest
env:
GIT_AUTHOR_NAME: ${{ github.event.commits[0].author.name }}
GIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
GIT_COMMITTER_NAME: kudo-sync-bot
GIT_COMMITTER_EMAIL: [email protected]
steps:
- name: Checkout adamlui/chatgpt-widescreen
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/chatgpt-widescreen
path: adamlui/chatgpt-widescreen
fetch-depth: 2
- name: Checkout adamlui/chatgpt-apps
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/chatgpt-apps
path: adamlui/chatgpt-apps
- name: Checkout adamlui/userscripts
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/userscripts
path: adamlui/userscripts
- name: Sync LICENSE.md from edge/* to <platform>/*
run: |
cd ${{ github.workspace }}/adamlui/chatgpt-widescreen
platforms=($(find . -type d -name "docs" | # paths to docs/
awk -F'/' '{print $(NF-1)}' | # filter to parents
grep -v "^edge$")) # exclude edge
echo "Platforms: ${platforms[@]}"
languages=($(ls docs/*/LICENSE.md | # paths to LICENSEs
awk -F'/' '{print $(NF-1)}') # filter to parents
"en") # include English
echo -e "Languages: ${languages[@]}\n"
for lang in "${languages[@]}"; do
edge_license=./edge$([[ "$lang" != "en" ]] && echo "/docs/$lang/" || echo "/")LICENSE.md
edge_license_content=$(git show HEAD:"$edge_license")
edge_license_modified=$(git log -1 --format="%ct" -- "$edge_license")
for platform in "${platforms[@]}"; do
platform_license=./$platform/$([[ "$lang" != "en" ]] && echo "docs/$lang/" || echo "")LICENSE.md
platform_license_content=$(git show HEAD:"$platform_license")
platform_license_modified=$(git log -1 --format="%ct" -- "$platform_license")
if [[ $edge_license_modified -gt $platform_license_modified ]] ; then
if [[ "$edge_license_content" != "$platform_license_content" ]] ; then
cp -f "$edge_license" "$platform_license"
echo "Copied $edge_license to $platform_license"
fi ; fi ; done; done
- name: Sync edge/extension/* to (chrome|opera)/extension/*
run: |
for browser in chrome opera
do
rsync -avhr --delete \
"${{ github.workspace }}/adamlui/chatgpt-widescreen/edge/extension/" \
"${{ github.workspace }}/adamlui/chatgpt-widescreen/$browser/extension"
done
- name: Sync edge/extension/_locales/* to greasemonkey/_locales/*
run: |
rsync -avhr --delete \
"${{ github.workspace }}/adamlui/chatgpt-widescreen/edge/extension/_locales/" \
"${{ github.workspace }}/adamlui/chatgpt-widescreen/greasemonkey/_locales"
- name: Sync ./* to adamlui/chatgpt-apps/chatgpt-widescreen/*
run: |
rsync -avhr --delete --exclude={'.*','eslint*','package*json'} \
${{ github.workspace }}/adamlui/chatgpt-widescreen/ \
${{ github.workspace }}/adamlui/chatgpt-apps/chatgpt-widescreen/
- name: Sync greasemonkey/* to adamlui/userscripts/chatgpt/chatgpt-widescreen/*
run: |
rsync -avhr --delete \
${{ github.workspace }}/adamlui/chatgpt-widescreen/greasemonkey/ \
${{ github.workspace }}/adamlui/userscripts/chatgpt/chatgpt-widescreen/
- 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: Push changes to adamlui/chatgpt-widescreen
run: |
cd ${{ github.workspace }}/adamlui/chatgpt-widescreen
git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from \`edge\`]" || true
git push
- name: Push changes to adamlui/chatgpt-apps
run: |
cd ${{ github.workspace }}/adamlui/chatgpt-apps
git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from \`adamlui/chatgpt-widescreen/edge\`]" || true
git push
- name: Push changes to adamlui/userscripts
run: |
cd ${{ github.workspace }}/adamlui/userscripts
git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from \`adamlui/chatgpt-widescreen/edge\`]" || true
git push