A fast, local-first "redirection engine" for !bang users with a few extra features ^-^
1name: Daily fetch bangs.json from Kagi
2on:
3 schedule:
4 - cron: "0 0 * * *"
5 workflow_dispatch:
6
7jobs:
8 fetch-bangs:
9 runs-on: ubuntu-latest
10 steps:
11 - uses: actions/checkout@v3
12
13 - name: Install bun
14 uses: oven-sh/setup-bun@v1
15
16 - name: Download bangs.json
17 run: |
18 curl -o bangs.json https://raw.githubusercontent.com/kagisearch/bangs/refs/heads/main/data/bangs.json
19
20 - name: Verify file
21 run: |
22 if [ ! -s bangs.json ]; then
23 echo "Downloaded file is empty"
24 exit 1
25 fi
26 if ! jq empty bangs.json; then
27 echo "Downloaded file is not valid JSON"
28 exit 1
29 fi
30
31 - name: Replace bangs.json
32 run: |
33 mkdir -p src
34 mv bangs.json src/bangs/bangs.json
35
36 - name: 🥔 hash
37 run: bun run hash
38
39 - name: Commit changes
40 run: |
41 git config --local user.email "github-actions[bot]@users.noreply.github.com"
42 git config --local user.name "github-actions[bot]"
43 git add src/bangs/bangs.json src/bangs/hashbang.ts
44 git commit -m "chore: update bangs.json" || exit 0
45 git push
46
47 - name: Tailscale
48 uses: tailscale/github-action@v3
49 with:
50 oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
51 oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
52 tags: tag:ci
53
54 - name: Add remote
55 run: git remote add tangled git@ember:did:plc:krxbvxvis5skq7jj6eot23ul/unduckified
56
57 - name: Configure ssh
58 run: |
59 mkdir -p ~/.ssh
60 echo "StrictHostKeyChecking no" >> ~/.ssh/config
61
62 - name: Push to tangled
63 run: git push tangled main