Skip to content

Commit 394f68c

Browse files
committed
feat: init aggregator
0 parents  commit 394f68c

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

.github/workflows/aggregate.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Aggregate Repositories
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- 'repositories.txt'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
aggregate:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
23+
- name: Configure Git
24+
run: |
25+
git config --global user.name "GitHub Actions"
26+
git config --global user.email "[email protected]"
27+
28+
- name: Run repository aggregation script
29+
run: |
30+
chmod +x ./aggregate.sh
31+
./aggregate.sh

README.org

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#+TITLE: guix-aggregator
2+
an automated repository that aggregates many guix dotfiles to be
3+
indexed by GitHub's search. this is updated once a day.
4+
5+
if you find your dotfiles in here and would like it removed, please
6+
feel free to contact me or open a pull request. or if you want to add
7+
your dotfiles instead, also please, PRs are welcome.
8+
9+
* motivation
10+
i found myself frequently going through multiple git forges, some of
11+
which don't have search/grep functionality, trying to find how others
12+
solved certain problems that i was encountering. this is an attempt to
13+
aggregate useful guix dotfiles and other guix related projects, so i
14+
can easily find examples.
15+
16+
* ~repositories.txt~
17+
this is the list of repositories you might want to change, it is a
18+
file with three whitespace seperated column, in the format
19+
#+BEGIN_SRC
20+
# owner/name url branch
21+
aemogie/aetheria https://codeberg.org/aemogie/aetheria.git dev
22+
#+END_SRC
23+
24+
the first column "owner/name" is used as the subdirectory to clone the
25+
repository into, the second as the url to the git repository, and the
26+
final as the branch to be cloned. empty lines and lines starting with
27+
~#~ are ignored, thus comments have to be on a seperate line.
28+

aggregate.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPOS_FILE="repositories.txt"
5+
LOCK_FILE="repositories.lock"
6+
REPOS_DIR="repos"
7+
8+
# PURGE!!
9+
rm -rf "$REPOS_DIR"
10+
mkdir -p "$REPOS_DIR"
11+
rm -f "$LOCK_FILE"
12+
13+
# the `||` is for when there's no trailing new line, but we still have content in the last line
14+
while read -r path url branch || [[ -n "$path" ]]; do
15+
# empty lines and comments allowed
16+
[[ -z "$path" || "$path" == \#* ]] && continue
17+
18+
dir="$REPOS_DIR/$path"
19+
20+
echo "Cloning repository: $path"
21+
mkdir -p "$dir"
22+
git clone --quiet --progress --depth 1 --no-tags --branch "$branch" "$url" "$dir"
23+
24+
hash=$(git -C "$dir" rev-parse HEAD)
25+
echo "$path $hash" >> "$LOCK_FILE"
26+
27+
rm -rf "$dir/.git"
28+
echo # newline
29+
done < "$REPOS_FILE"
30+
31+
last_update=$(git log -1 --format=%cd --date=short 2>/dev/null || echo "initial")
32+
current_date=$(date +%Y-%m-%d)
33+
commit_title="Update repositories: $last_update to $current_date"
34+
commit_body="$(git diff --word-diff HEAD -- "$LOCK_FILE" | tail -n +6)"
35+
36+
git add .
37+
git commit -m "$commit_title" -m "$commit_body"
38+
git push origin HEAD

repositories.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# owner/name url branch
2+
aemogie/aetheria https://github.com/aemogie/aetheria.git dev
3+
abcdw/rde https://git.sr.ht/~abcdw/rde master
4+
anemofilia/zero https://codeberg.org/anemofilia/zero.git main
5+
look/misako https://codeberg.org/look/misako.git main
6+
hako/Testament https://git.boiledscript.com/hako/Testament.git trunk
7+
jjba23/sss https://codeberg.org/jjba23/sss.git trunk
8+
divyaranjan/dotfiles https://codeberg.org/divyaranjan/dotfiles.git master
9+
wloxyz/guix-configs https://codeberg.org/wloxyz/guix-configs.git main
10+
lynn/galahad.git https://git.transistor.house/lynn/galahad.git main
11+
ngraves/dotfiles https://git.sr.ht/~ngraves/dotfiles main
12+
13+
# this was slow, doubt their servers would be okay with my
14+
# cronjobs. couldnt find any mirrors
15+
# freya/dotfiles-guix https://g.freya.cat/freya/dotfiles-guix.git main

0 commit comments

Comments
 (0)