Skip to content

Commit

Permalink
feat(listing): fix workflow and logo URI
Browse files Browse the repository at this point in the history
  • Loading branch information
darkpaladi committed Aug 15, 2024
1 parent 53541cc commit 2cbd606
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 53 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Analyze Token
on:
pull_request:
branches:
# - master
- feat/telegram-bot
- master

jobs:
analyze:
Expand Down Expand Up @@ -44,17 +43,23 @@ jobs:
run: |
npm run build
- name: Configure git
if: env.SKIP == 'false'
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
- name: Commit changes
if: env.SKIP == 'false'
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
# Get the current branch name
BRANCH_NAME=${GITHUB_HEAD_REF}
git fetch origin $BRANCH_NAME
git checkout $BRANCH_NAME
git add .
git commit -m "Automated build update"
git push
git rebase origin/$BRANCH_NAME
git push origin HEAD:$BRANCH_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/telegram-notify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Notify Telegram on JSON Update

on:
push:
branches:
- master
paths:
- '**/voltage-swap-default.tokenlist.json'

jobs:
notify:
environment: TELEGRAM
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run notify script
run: npm run notify:telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}

- name: Commit changes
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
# Get the current branch name
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
# Check if new-token.json has been modified
if git diff --name-only | grep -q "new-token.json"; then
echo "A new-token.json file has been modified. Committing changes."
git fetch origin $BRANCH_NAME
git checkout $BRANCH_NAME
git add "**/new-token.json"
git commit -m "Update new-token.json file"
git push origin HEAD:$BRANCH_NAME
else
echo "No new-token.json file has been modified. Skipping commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

41 changes: 0 additions & 41 deletions .github/workflows/telegram-notify.yml

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ async function analyze() {
}

const view = {
address: newToken.address,
name: newToken.name,
address: newToken.address,
symbol: newToken.symbol,
decimals: newToken.decimals,
logoURI: getLogoURI(newToken.address),
logoURI: newToken.logoURI,
contributors: contributors.map((c) => `@${c}`).join(' '),
errors,
}
Expand Down Expand Up @@ -87,7 +87,7 @@ async function analyze() {
symbol: newToken.symbol,
decimals: newToken.decimals,
chainId: newToken.chainId,
logoURI: getLogoURI(newToken.address),
logoURI: newToken.logoURI,
}

// Add the new token to the list
Expand Down
4 changes: 4 additions & 0 deletions scripts/notify-telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ if (!TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID) {
}

async function sendMessage(chatId) {
if (newToken?.name.length == 0) {
return
}

const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`

const text = `
Expand Down

0 comments on commit 2cbd606

Please sign in to comment.