Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Sync with Upstream

Sync with Upstream #88

name: Sync with Upstream
on:
schedule:
- cron: "0 * * * *" # Runs every hour, adjust the cron schedule as needed
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Forked Repo
uses: actions/checkout@v3
with:
repository: isabelle-pundix/FXSwap-TokenList
token: ${{ secrets.TOKEN }}
fetch-depth: 0
- name: Set Up Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Add Upstream Remote
run: git remote add upstream https://github.com/FunctionX-SG/FXSwap-TokenList.git
- name: Fetch Upstream Changes
run: git fetch upstream
- name: Check for Differences in Tokens Directory and FXList.json
id: check_diff
run: |
git fetch upstream main
if git diff --quiet upstream/main -- Tokens FXList.json; then
echo "changes=false" >> $GITHUB_ENV
else
echo "changes=true" >> $GITHUB_ENV
fi
- name: Merge Upstream Changes
if: env.changes == 'true'
run: |
git merge upstream/main
- name: Pull Latest Changes from Origin
if: env.changes == 'true'
run: git pull origin main
- name: Push Changes
if: env.changes == 'true'
run: git push origin main
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}