From d10642fa9583ba5350ff52113966ca13d499c2a8 Mon Sep 17 00:00:00 2001 From: Stepan Lavrentev Date: Mon, 2 Sep 2024 13:27:40 +0300 Subject: [PATCH 1/4] fix: return update list workflow --- .github/workflows/update_project_list.yml | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/update_project_list.yml diff --git a/.github/workflows/update_project_list.yml b/.github/workflows/update_project_list.yml new file mode 100644 index 00000000..5d0e89e6 --- /dev/null +++ b/.github/workflows/update_project_list.yml @@ -0,0 +1,41 @@ +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 }} + +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 From f5b7d0ffd32fbd42c32cc47e5417c1cd82ba96fa Mon Sep 17 00:00:00 2001 From: Stepan Lavrentev Date: Mon, 2 Sep 2024 13:38:00 +0300 Subject: [PATCH 2/4] fix: adding permissions --- .github/workflows/update_project_list.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update_project_list.yml b/.github/workflows/update_project_list.yml index 5d0e89e6..6faeabab 100644 --- a/.github/workflows/update_project_list.yml +++ b/.github/workflows/update_project_list.yml @@ -11,6 +11,10 @@ env: 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 From 72f4837efd9a77096e7f7182b31d2229bb45502a Mon Sep 17 00:00:00 2001 From: Stepan Lavrentev Date: Mon, 2 Sep 2024 14:20:16 +0300 Subject: [PATCH 3/4] fix: update progress bar --- scripts/python_scripts/table_representation.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/python_scripts/table_representation.py b/scripts/python_scripts/table_representation.py index e3a626ed..d5a2809c 100644 --- a/scripts/python_scripts/table_representation.py +++ b/scripts/python_scripts/table_representation.py @@ -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 = 20 + 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: From 8417f9cfa66a105e33e7135b9537ea857609ce52 Mon Sep 17 00:00:00 2001 From: Stepan Lavrentev Date: Mon, 2 Sep 2024 14:27:01 +0300 Subject: [PATCH 4/4] fix: bar length --- scripts/python_scripts/table_representation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/python_scripts/table_representation.py b/scripts/python_scripts/table_representation.py index d5a2809c..34a3fe86 100644 --- a/scripts/python_scripts/table_representation.py +++ b/scripts/python_scripts/table_representation.py @@ -93,7 +93,7 @@ def fill_status_bar(self, instance: DeploymentInstance, project: SubQueryProject return f'{progress_bar} {percent}%', commit def generate_progress_bar(self, percent: int) -> str: - bar_length = 20 + bar_length = 5 filled_length = int(bar_length * percent // 100) bar = '█' * filled_length + '-' * (bar_length - filled_length) return f'[{bar}]'