From 1511a258484f45dc90b1f95f4f45df99c1cfdfd8 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Wed, 28 Feb 2024 21:27:40 +0100 Subject: [PATCH] dashboard: use new badge links It looks like the badge.url provided by GitHub is unreliable and returns an old link format. Instead, manually generate the correct one. Signed-off-by: Gerwin Klein --- dashboard/gen-dashboard.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/dashboard/gen-dashboard.py b/dashboard/gen-dashboard.py index 29172d57..d0e577f9 100755 --- a/dashboard/gen-dashboard.py +++ b/dashboard/gen-dashboard.py @@ -17,6 +17,15 @@ "website_pr_hosting", ] +# Repos in which the main branch is called 'main': +main_branch_repos = [ + "microkit", + "rust-microkit-demo", + "rust-microkit-http-server-demo", + "rust-root-task-demo", + "rust-sel4", +] + # Exclude workflows that are not available on default branch: exlude_workflows = { "website": ["action.yml", "main.yml", "bamboo-pr.yml"], @@ -96,12 +105,12 @@ def print_header(): ## Main Tests -[![seL4Test](https://github.com/seL4/seL4/workflows/seL4Test/badge.svg?branch=master)](https://github.com/seL4/seL4/actions/workflows/sel4test-deploy.yml?query=branch%3Amaster) -[![Proofs](https://github.com/seL4/l4v/workflows/Proofs/badge.svg?branch=master)](https://github.com/seL4/l4v/actions/workflows/proof-deploy.yml?query=branch%3Amaster) -[![Proof Sync](https://github.com/seL4/seL4/workflows/Proof%20Sync/badge.svg?branch=master)](https://github.com/seL4/seL4/actions/workflows/preprocess-deploy.yml?query=branch%3Amaster) -[![seL4Bench](https://github.com/seL4/sel4bench/workflows/seL4Bench/badge.svg?branch=master)](https://github.com/seL4/sel4bench/actions/workflows/sel4bench.yml?query=branch%3Amaster) -[![CAmkES](https://github.com/seL4/camkes-tool/workflows/CAmkES/badge.svg?branch=master)](https://github.com/seL4/camkes-tool/actions/workflows/camkes-deploy.yml?query=branch%3Amaster) -[![Camkes VM](https://github.com/seL4/camkes-vm-examples/workflows/Camkes%20VM/badge.svg?branch=master)](https://github.com/seL4/camkes-vm-examples/actions/workflows/camkes-vm-deploy.yml?query=branch%3Amaster) +[![seL4Test](https://github.com/seL4/seL4/actions/workflows/sel4test-deploy.yml/badge.svg?branch=master)](https://github.com/seL4/seL4/actions/workflows/sel4test-deploy.yml?query=branch%3Amaster) +[![Proofs](https://github.com/seL4/l4v/actions/workflows/proof-deploy.yml/badge.svg)](https://github.com/seL4/l4v/actions/workflows/proof-deploy.yml?query=branch%3Amaster) +[![Proof Sync](https://github.com/seL4/seL4/actions/workflows/preprocess-deploy.yml/badge.svg?branch=master)](https://github.com/seL4/seL4/actions/workflows/preprocess-deploy.yml?query=branch%3Amaster) +[![seL4Bench](https://github.com/seL4/sel4bench/actions/workflows/sel4bench.yml/badge.svg?branch=master)](https://github.com/seL4/sel4bench/actions/workflows/sel4bench.yml?query=branch%3Amaster) +[![CAmkES](https://github.com/seL4/camkes-tool/actions/workflows/camkes-deploy.yml/badge.svg?branch=master)](https://github.com/seL4/camkes-tool/actions/workflows/camkes-deploy.yml?query=branch%3Amaster) +[![CAmkES VM](https://github.com/seL4/camkes-vm-examples/actions/workflows/camkes-vm-deploy.yml/badge.svg?branch=master)](https://github.com/seL4/camkes-vm-examples/actions/workflows/camkes-vm-deploy.yml?query=branch%3Amaster) ----- @@ -117,11 +126,12 @@ def print_repo(repo_name): def print_workflow(repo, workflow): '''Print a single workflow.''' + branch_name = "main" if repo in main_branch_repos else "master" + workflow_name = os.path.basename(workflow.path) base_url = f"{org_url}/{repo}/actions/workflows" - action_url = f"{base_url}/{os.path.basename(workflow.path)}?query=branch%3Amaster" - print(f"[![{workflow.name}]({workflow.badge_url}" - f"?branch=master)]({action_url})") - + badge_url = f"{base_url}/{workflow_name}/badge.svg?branch={branch_name}" + action_url = f"{base_url}/{workflow_name}?query=branch%3A{branch_name}" + print(f"[![{workflow.name}]({badge_url})]({action_url})") def print_badges(workflows: dict): print("## Main repositories\n")