whatwg / spec-factory

WHATWG Standard repository templates and infrastructure
Creative Commons Zero v1.0 Universal
34 stars 33 forks source link

Script silently includes extra changes if a repo has local changes #20

Open foolip opened 4 years ago

foolip commented 4 years ago

https://github.com/whatwg/dom/pull/877 includes lots of other changes, where I had a .spec.whatwg.org directory in my dom/ checkout, after a bug fixed in https://github.com/whatwg/whatwg.org/pull/325.

The script should either fail if there are any local changes, or just make fresh copies of all repos. As it is, it assumes you have all repos checkout out alongside spec-factory, but how to keep those up-to-date is an exercise for the reader. Here's the script I've arrived at over time:

#!/bin/bash -e

curl --silent --fail "https://api.github.com/orgs/whatwg/repos?per_page=100" | \
    #grep -E '^    "name":' | cut -d \" -f4 | \
    #grep -vE '^(domparsing|javascript|old-google-code-html5|resources.whatwg.org)$' | \
    jq -r '.[] | select(.archived == false) | .name' | sort | \
    while read name; do
        if [[ -d "$name" ]]; then
            echo "Updating $name"
            (
                cd "$name"
                git fetch --prune
                git rebase-update --no-fetch --keep-going
            )
        else
            echo "Cloning $name"
            git clone "git@github.com:whatwg/$name.git"
        fi
    done

It would be good if it just works instead.

annevk commented 4 years ago

It emulates https://github.com/whatwg/whatwg.org/blob/381944022adf44dfd45d0c03c38b33ba087b72a2/resources.whatwg.org/build/review.sh#L19-L21 at the moment. There are indeed a number of ways that can fail.