Skip to content

Instantly share code, notes, and snippets.

@crqrdotcom
Last active December 22, 2022 15:21
Show Gist options
  • Select an option

  • Save crqrdotcom/7ad034958dc02b141415241b321400d1 to your computer and use it in GitHub Desktop.

Select an option

Save crqrdotcom/7ad034958dc02b141415241b321400d1 to your computer and use it in GitHub Desktop.
Run Reposaur against every repository in an organization

This script runs Reposaur against every repository in an organization, generating a report in report.json.

Run:

$ chmod +x script.sh
$ ./script.sh <ORGANIZATION>

Replacing <ORGANIZATION> with the name of the organization you want to test.

package repository
# METADATA
# title: Repository description is empty
# description: >
# The repository description is empty. Having a description is
# important to help discoverability and other people to understand
# the purpose of a repository.
# custom:
# tags: [guidelines, best-practices]
warn_empty_description {
input.description == null
}
#!/usr/bin/env bash
owner="$1"
repos=$(gh api "/orgs/$owner/repos" --paginate)
reports=""
for row in $(echo "$repos" | jq -r '.[] | @base64'); do
_repo() {
echo ${row} | base64 -d | jq -r ${1}
}
# create report
report=$(_repo '.' | reposaur -f json -p . | jq -c)
# append report to global list
reports="$reports {\"$(_repo '.name')\": $report}"
done
# combine reports in single object and write to report.json
echo -E "$reports" | jq -s add > report.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment