Skip to content

Instantly share code, notes, and snippets.

@rlanyi
Last active May 6, 2019 15:02
Show Gist options
  • Save rlanyi/b782e8bc9fd341c03c68bef173682660 to your computer and use it in GitHub Desktop.
Save rlanyi/b782e8bc9fd341c03c68bef173682660 to your computer and use it in GitHub Desktop.
Get labels and if they are on group/project level from GitLab
#!/bin/bash
for group in $(gitlab -o json group list | jq -r .[].id); do for project in $(gitlab -o json group-project list --group-id $group | jq -r .[].id); do path_with_namespace=$(gitlab -o json project get --id $project | jq -r .path_with_namespace) ; tempfile=$(echo $path_with_namespace | sed "s/\//_/g"); echo -e "\nProject: $path_with_namespace ($temppath)" | tee $tempfile; gitlab -o json project-label list --project-id $project | jq -r '.[] | [.name, .is_project_label|tostring] | join(" ")' | tee $tempfile ; done; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment