Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return update list workflow #303

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/update_project_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Projects healthcheck

on:
schedule:
- cron: "0 0/4 * * *"
workflow_dispatch:
pull_request:

env:
SUBQUERY_TOKEN: ${{ secrets.SUBQUERY_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}

permissions:
contents: write
pull-requests: write

jobs:
generate_project_list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./scripts/python_scripts/requirements.txt

- name: Generate table
run: python ./scripts/python_scripts/generate_network_status.py

- uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages

- name: Copy table to gh-pages
run: mv ./gh-pages-temp/README.md ./gh-pages/README.md

- name: Deploy report to Github Pages
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: gh-pages
16 changes: 12 additions & 4 deletions scripts/python_scripts/table_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ def generate_progress_status(self, project: SubQueryProject):

def fill_status_bar(self, instance: DeploymentInstance, project: SubQueryProject):
if not instance:
return '![0](https://progress-bar.dev/0?title=N/A)', '-'
return 'N/A', '-'
commit = instance.version[0:8]
if instance.status == 'processing':
return '![0](https://progress-bar.dev/0?title=Processing...)', commit
return 'Processing...', commit
if instance.status == 'error' and self.get_sync_percentage(instance, project) == '0':
return '![0](https://progress-bar.dev/0?title=Error)', commit
return 'Error', commit
percent = self.get_sync_percentage(instance, project)
return f'![{percent}](https://progress-bar.dev/{percent}?title={instance.type.capitalize()})', commit
percent = min(int(percent), 100)
progress_bar = self.generate_progress_bar(percent)
return f'{progress_bar} {percent}%', commit

def generate_progress_bar(self, percent: int) -> str:
bar_length = 5
filled_length = int(bar_length * percent // 100)
bar = '█' * filled_length + '-' * (bar_length - filled_length)
return f'[{bar}]'

def is_sync_status_valid(self, sync_status):
if sync_status is None:
Expand Down
Loading