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 #16

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
git diff --exit-code upstream/main -- Tokens FXList.json || echo "changes"
if [ $? -eq 0 ]; then
echo "::set-output name=changes::false"
else
echo "::set-output name=changes::true"
fi
- name: Merge Upstream Changes
if: steps.check_diff.outputs.changes == 'true'
run: |
git merge upstream/main
- name: Pull Latest Changes from Origin
if: steps.check_diff.outputs.changes == 'true'
run: git pull origin main
- name: Push Changes
if: steps.check_diff.outputs.changes == 'true'
run: git push origin main
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}