Skip to content

Commit

Permalink
dashboard: use new badge links
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lsf37 committed Feb 29, 2024
1 parent 63d8c71 commit e3d1a28
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions dashboard/gen-dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -96,12 +105,12 @@ def print_header():
## Main Tests
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![seL4Bench](https://github.com/seL4/sel4bench/workflows/seL4Bench/badge.svg?branch=master)](https://github.com/seL4/sel4bench/actions/workflows/sel4bench.yml?query=branch%3Amaster)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
<span class="plain-links">[![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)</span>
-----
Expand All @@ -117,10 +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"<span class=\"plain-links\">[![{workflow.name}]({workflow.badge_url}"
f"?branch=master)]({action_url})</span>")
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"<span class=\"plain-links\">[![{workflow.name}]({badge_url})]({action_url})</span>")


def print_badges(workflows: dict):
Expand Down

0 comments on commit e3d1a28

Please sign in to comment.