A fast, local-first "redirection engine" for !bang users with a few extra features ^-^
1name: Daily fetch bangs.json from DDG
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://duckduckgo.com/bang.js
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