codiform / gh-actions-usage

GitHub CLI Extension to display Github Actions Usage. Go version of gh-actuse.
18 stars 2 forks source link

Enabled Repos #23

Open geoffreywiseman opened 1 year ago

geoffreywiseman commented 1 year ago

There's a setting to indicate if GitHub Actions is enabled on all, selected, or none workflows. The bash extension used this to help indicate which repos to target:

    enabled_repos=$(gh api "/orgs/$org_name/actions/permissions" --jq ".enabled_repositories")
    case "$enabled_repos" in
        all)
        echo "- GitHub Actions enabled on All Repos"
        print_org_repos "$org_name" "All Repos" "repos"
        ;;
        selected)
        echo "- GitHub Actions enabled on Selected Repos"
        print_org_repos "$org_name" "Selected Repos" "actions/permissions/repositories"
        ;;
        none)
        echo "- GitHub Actions is not enabled on any repositories"
        ;;
        *)
        echo "- GitHub Actions is enabled on $enabled_repos?"
    esac
}

Might as well reproduce that logic somewhat, although again may be necessary to consider the code structure since we're mapping from orgs to repos before processing.