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 45 # Check if the last commit was a bangs update 46 LAST_COMMIT_MSG=$(git log -1 --pretty=%B) 47 if [[ "$LAST_COMMIT_MSG" == "chore: update bangs.json" ]]; then 48 # If it was, amend the commit 49 git commit --amend -m "chore: update bangs.json" || exit 0 50 else 51 # Otherwise, create a new commit 52 git commit -m "chore: update bangs.json" || exit 0 53 fi 54 55 git push --force-with-lease 56 57 - name: Tailscale 58 uses: tailscale/github-action@v3 59 with: 60 oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} 61 oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} 62 tags: tag:ci 63 64 - name: Add remote 65 run: git remote add tangled git@ember:did:plc:krxbvxvis5skq7jj6eot23ul/unduckified 66 67 - name: Configure ssh 68 run: | 69 mkdir -p ~/.ssh 70 echo "StrictHostKeyChecking no" >> ~/.ssh/config 71 72 - name: Push to tangled 73 run: git push tangled main