Merge pull request #43 from voltfinance/7850814781/add-wbtc-token #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |