Commit 24d5dd1e authored by Mehdi Dogguy's avatar Mehdi Dogguy

Merge branch 'master' into 'master'

Master

See merge request !2
parents 27b2aea2 5f64ae6f
......@@ -23,7 +23,14 @@ in commit messages.
* emails_on_push.sh foo "email addresses"
Sets up email notifications on push for project 'foo'. Emails will be sent
to "mail addresses".
to "email addresses" (this second argument can be omitted, in which case
emails will be sent to dispatch+foo_vcs@tracker.debian.org).
* list_projects.sh pkg-baz
Lists on stdout all the projects of the group pkg-baz, one project per line.
The list will contain at least public projects, and also private projects to
which the token gives access to.
In order to use these scripts, you must create a 'salsarc' file with the
following content:
......
#!/bin/sh
set -e
. ./salsarc
if [ "$#" -ne 1 ] || [ -z "$1" ] ; then
echo "Usage: $0 pkg-baz" >&2
echo " where 'pkg-baz' is the name of the Salsa group for which you want the project list" >&2
exit 1
fi
SALSA_GROUP="$1"
PER_PAGE=100
HEADERS_FILE=$(mktemp)
trap "rm -f $HEADERS_FILE" EXIT
SALSA_GROUP_ID=$(curl --silent -f -XGET --header "PRIVATE-TOKEN: $SALSA_TOKEN" "$SALSA_URL/groups?all_available=false" | jq ".[] | select(.path == \"$SALSA_GROUP\") | .id")
get_one_page ()
{
curl --silent -D $HEADERS_FILE "$SALSA_URL/groups/$SALSA_GROUP_ID/projects?private_token=$SALSA_TOKEN&simple=true&per_page=$PER_PAGE&page=$PAGENO" | jq --raw-output ".[] | .path"
}
PAGENO=1
get_one_page
TOTAL_PAGES=$(grep ^X-Total-Pages: $HEADERS_FILE)
TOTAL_PAGES=${TOTAL_PAGES#*: }
while [ $PAGENO -lt $TOTAL_PAGES ]
do
PAGENO=$((PAGENO+1))
get_one_page
done
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