Commit 3534ffb5 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat: add a script to add a pipeline badget to all projects

parent ba4d420ca03b
import os
import gitlab
gl = gitlab.Gitlab("https://forge.extranet.logilab.fr", oauth_token=os.environ.get("TOKEN"))
all_core_projects = [x for x in gl.projects.list(all=True) if "cw-core" in x.tag_list]
all_cubes = [x for x in gl.projects.list(all=True) if x.namespace["name"] == "cubes"]
for project in all_core_projects + all_cubes:
existing_badges = {x.name for x in project.badges.list(all=True)}
if "pipeline" not in existing_badges:
print(f'Add pipeline badget to {project.name_with_namespace.replace(" ", "")} ({project.web_url})...')
project.badges.create({
"name": "pipeline",
"link_url": "https://forge.extranet.logilab.fr/%{project_path}/-/pipelines",
"image_url": "https://forge.extranet.logilab.fr/%{project_path}/badges/%{default_branch}/pipeline.svg"
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment