aboutsummaryrefslogtreecommitdiffhomepage
path: root/services/repos/scripts/fetch-repos.sh
blob: ce9105b3494d24f60f8f3018ef0037bb5a6d295d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

set -euo pipefail

for repo_path in repos/*; do
    if [[ -d "$repo_path" ]]; then
        repo_name=$(basename "$repo_path" .git)
        echo "Fetching $repo_name"
        git -C "$repo_path" fetch --tags --prune origin

        # Update agefile.
        mkdir -p "$repo_path/info/web"
        git -C "$repo_path" for-each-ref \
            --sort=-committerdate \
            --format='%(committerdate:format:%Y-%m-%d %H:%M:%S)' \
            refs/ \
        | head -1 > "$repo_path/info/web/last-modified"
    fi
done