diff --git a/.github/workflows/cleanup-branches.yml b/.github/workflows/cleanup-branches.yml deleted file mode 100644 index fe10747..0000000 --- a/.github/workflows/cleanup-branches.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Cleanup Stale Branches - -on: - schedule: - # Runs at 00:00 every day - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - delete_old_branches: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Fetch all branches - run: git fetch --all - - - name: Delete stale branches - run: | - # Get the date 7 days ago in YYYY-MM-DD format - seven_days_ago=$(date -d '7 days ago' +%Y-%m-%d) - - # List branches that haven't been updated in the last 7 days - for branch in $(git for-each-ref --format='%(refname:short) %(committerdate:short)' refs/remotes/origin | awk -v date="$seven_days_ago" '$2 <= date {print $1}'); do - # Ensure the branch is not 'main', 'master', or any protected branches - if [[ "$branch" != "origin/main" && "$branch" != "origin/master" && "$branch" != *"HEAD"* ]]; then - git push origin --delete ${branch#origin/} - echo "Deleted branch $branch" - fi - done - - - name: Cleanup - run: git remote prune origin diff --git a/.github/workflows/sync-with-upstream.yml b/.github/workflows/sync-with-upstream.yml deleted file mode 100644 index 11203cb..0000000 --- a/.github/workflows/sync-with-upstream.yml +++ /dev/null @@ -1,62 +0,0 @@ -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: marginx-spot-trade/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 'github-actions@github.com' - - - 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 and Preserve All Workflows - if: env.changes == 'true' - run: | - git merge -X ours --no-commit upstream/main || true - # Ensure all workflow files are preserved - for file in .github/workflows/*; do - if [ -e "$file" ]; then - git checkout --ours "$file" - fi - done - git add .github/workflows/ - git commit -m "Merge upstream changes while keeping all forked workflows" - - - name: Pull Latest Changes from Origin - if: env.changes == 'true' - run: git pull origin main --rebase - - - name: Push Changes - if: env.changes == 'true' - run: git push origin main - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} diff --git a/.github/workflows/update-token-list.yml b/.github/workflows/update-token-list.yml deleted file mode 100644 index 3eb8306..0000000 --- a/.github/workflows/update-token-list.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: Update Token List - -on: - workflow_dispatch: - inputs: - name: - description: "Token name" - required: true - chainId: - description: "Chain ID" - required: true - symbol: - description: "Token symbol" - required: true - address: - description: "Token address" - required: true - decimals: - description: "Token decimals" - required: true - image: - description: "Token logo (base64 encoded)" - required: true - twitter: - description: "Twitter handle" - required: false - website: - description: "Website URL" - required: false - -jobs: - update-token-list: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Set up Git configuration - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git config core.autocrlf input - - - name: Determine logo file name - id: determine_logo - run: | - case "${{ github.event.inputs.chainId }}" in - 530) - logo_filename="logo.png" - ;; - 90001) - logo_filename="logo-testnet.png" - ;; - 7000) - logo_filename="logo-zeta.png" - ;; - 7001) - logo_filename="logo-athens.png" - ;; - *) - logo_filename="logo.png" - ;; - esac - echo "logo_filename=$logo_filename" >> $GITHUB_ENV - - - name: Debug inputs - run: | - echo "Twitter: '${{ github.event.inputs.twitter }}'" - echo "Website: '${{ github.event.inputs.website }}'" - - - name: Decode and save image - run: | - mkdir -p Tokens/${{ github.event.inputs.address }} - echo "${{ github.event.inputs.image }}" | base64 --decode > Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }} - - - name: List files in Tokens directory - run: ls -R Tokens/ - - - name: Prepare branch and token entry - id: prepare - run: | - name="${{ github.event.inputs.name }}" - symbol="${{ github.event.inputs.symbol }}" - address="${{ github.event.inputs.address }}" - sanitized_name=$(echo "$name" | tr ' ' '-' | tr -cd '[:alnum:]-') - sanitized_symbol=$(echo "$symbol" | tr ' ' '-' | tr -cd '[:alnum:]-') - sanitized_address=$(echo "$address" | tr ' ' '-' | tr -cd '[:alnum:]-') - branch_name="add-token-$sanitized_address-$sanitized_name-$sanitized_symbol" - - # Save branch name to be used in subsequent steps - echo "branch_name=$branch_name" >> $GITHUB_ENV - - - name: Pull latest changes from main - run: | - git checkout main - git pull origin main - - - name: Print branch name - run: | - echo "Branch name: ${{ env.branch_name }}" - - - name: Normalize line endings in FXList.json - run: | - awk '{ sub("\r$", ""); print }' FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Format FXList.json before changes - run: | - jq --indent 4 . FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Append new token to FXList.json - run: | - logoURI="https://raw.githubusercontent.com/FunctionX-SG/FXSwap-TokenList/main/Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }}" - # Create token entry - token_entry=$(jq -n \ - --arg name "${{ github.event.inputs.name }}" \ - --argjson chainId "${{ github.event.inputs.chainId }}" \ - --arg symbol "${{ github.event.inputs.symbol }}" \ - --argjson decimals "${{ github.event.inputs.decimals }}" \ - --arg address "${{ github.event.inputs.address }}" \ - --arg logoURI "$logoURI" \ - --arg twitter "${{ github.event.inputs.twitter }}" \ - --arg website "${{ github.event.inputs.website }}" \ - '{name: $name, chainId: $chainId, symbol: $symbol, decimals: $decimals, address: $address, logoURI: $logoURI, extensions: {twitter: $twitter, website: $website}} | with_entries(select(.value != "" and .value != null)) | .extensions |= with_entries(select(.value != "" and .value != null))') - # Append the new entry to the tokens array in FXList.json - jq --argjson token_entry "$token_entry" '.tokens += [$token_entry]' FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Format FXList.json after changes - run: | - jq --indent 4 . FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Check if branch exists locally and delete if it does - run: | - if git show-ref --quiet refs/heads/${{ env.branch_name }}; then - echo "Branch exists locally. Deleting local branch ${{ env.branch_name }}." - git branch -D ${{ env.branch_name }} - else - echo "Branch does not exist locally." - fi - - - name: Check if branch exists remotely and delete if it does - run: | - if git ls-remote --exit-code --heads origin ${{ env.branch_name }}; then - echo "Branch exists remotely. Deleting remote branch ${{ env.branch_name }}." - git push origin --delete ${{ env.branch_name }} - else - echo "Branch does not exist remotely." - fi - - - name: Commit changes - run: | - git checkout -b ${{ env.branch_name }} - git rm -r .github/workflows - git add FXList.json Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }} - git commit -m "Add token ${{ github.event.inputs.address }} ${{ github.event.inputs.name }} (${{ github.event.inputs.symbol }})" - git pull origin main --rebase - git push origin ${{ env.branch_name }} - - - name: Install GitHub CLI - run: | - sudo apt-get update - sudo apt-get install gh - - - name: Create Pull Request with GH CLI - env: - GH_TOKEN: ${{ secrets.TOKEN }} - run: | - gh pr create --repo FunctionX-SG/FXSwap-TokenList --base main --head marginx-spot-trade:${{ env.branch_name }} --title "Add ${{ github.event.inputs.name }} Token" --body "This PR adds a new token with address ${{ github.event.inputs.address }}, name '${{ github.event.inputs.name }}' and symbol '${{ github.event.inputs.symbol }}'." - - # gh pr create --title "Add ${{ github.event.inputs.name }} Token" \ - # --body "This PR adds a new token with name '${{ github.event.inputs.name }}' and symbol '${{ github.event.inputs.symbol }}'." \ - # --base main \ - # --head marginx-spot-trade:${{ env.branch_name }} diff --git a/FXList.json b/FXList.json index 394f4fb..f3ec3fa 100644 --- a/FXList.json +++ b/FXList.json @@ -1023,6 +1023,15 @@ "twitter": "www.x.com/test", "website": "www.test.com" } + }, + { + "name": "MINI", + "chainId": 530, + "symbol": "MINI", + "decimals": 1, + "address": "0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1", + "logoURI": "https://raw.githubusercontent.com/FunctionX-SG/FXSwap-TokenList/main/Tokens/0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1/logo.png", + "extensions": {} } ] } diff --git a/Tokens/0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1/logo.png b/Tokens/0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1/logo.png new file mode 100644 index 0000000..b081161 Binary files /dev/null and b/Tokens/0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1/logo.png differ