tangled
alpha
login
or
join now
dunkirk.sh
/
unduckified
5
fork
atom
A fast, local-first "redirection engine" for !bang users with a few extra features ^-^
5
fork
atom
overview
issues
pulls
pipelines
feat: hopefully avoid repo squashing
dunkirk.sh
9 months ago
3b1e4106
5acf9235
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+49
-20
1 changed file
expand all
collapse all
unified
split
.github
workflows
update-bangs.yaml
+49
-20
.github/workflows/update-bangs.yaml
···
8
fetch-bangs:
9
runs-on: ubuntu-latest
10
steps:
11
-
- uses: actions/checkout@v3
0
0
0
12
13
- name: Install bun
14
uses: oven-sh/setup-bun@v1
···
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]"
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
0
0
0
···
8
fetch-bangs:
9
runs-on: ubuntu-latest
10
steps:
11
+
- name: Checkout repository
12
+
uses: actions/checkout@v3
13
+
with:
14
+
fetch-depth: 1
15
16
- name: Install bun
17
uses: oven-sh/setup-bun@v1
···
33
34
- name: Replace bangs.json
35
run: |
36
+
mkdir -p src/bangs
37
mv bangs.json src/bangs/bangs.json
38
39
- name: 🥔 hash
40
run: bun run hash
41
42
+
- name: Configure Git
43
run: |
44
git config --local user.email "github-actions[bot]@users.noreply.github.com"
45
git config --local user.name "github-actions[bot]"
46
+
47
+
- name: Check for changes and commit
48
+
id: check_changes
49
+
run: |
50
git add src/bangs/bangs.json src/bangs/hashbang.ts
51
+
52
+
# Check if there are changes to commit
53
+
if git diff --staged --quiet; then
54
+
echo "No changes to commit"
55
+
echo "has_changes=false" >> $GITHUB_OUTPUT
56
+
exit 0
57
+
fi
58
+
59
+
echo "Changes detected in bangs files"
60
+
echo "has_changes=true" >> $GITHUB_OUTPUT
61
+
62
+
# Look for bangs update commits in history
63
+
git fetch origin main --unshallow
64
+
65
+
# Check if previous commit was a bangs update
66
+
PREV_COMMIT_MSG=$(git log -1 --pretty=%B)
67
+
if [[ "$PREV_COMMIT_MSG" == "chore: update bangs.json" ]]; then
68
+
# Amend the previous commit
69
+
git commit --amend -m "chore: update bangs.json"
70
+
else
71
+
# Create a new commit
72
+
git commit -m "chore: update bangs.json"
73
+
fi
74
+
75
+
# Push to main - using force only if we amended
76
+
if [[ "$PREV_COMMIT_MSG" == "chore: update bangs.json" ]]; then
77
+
git push --force-with-lease origin main
78
else
79
+
git push origin main
0
80
fi
81
82
+
# Handle Tangled push only if we have new changes
83
+
- name: Setup Tailscale
84
+
if: steps.check_changes.outputs.has_changes == 'true'
85
uses: tailscale/github-action@v3
86
with:
87
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
88
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
89
tags: tag:ci
90
91
+
- name: Configure SSH
92
+
if: steps.check_changes.outputs.has_changes == 'true'
0
0
93
run: |
94
mkdir -p ~/.ssh
95
echo "StrictHostKeyChecking no" >> ~/.ssh/config
96
97
+
- name: Push to Tangled
98
+
if: steps.check_changes.outputs.has_changes == 'true'
99
+
run: |
100
+
git remote add tangled git@ember:did:plc:krxbvxvis5skq7jj6eot23ul/unduckified || true
101
+
git push tangled main
102
+
continue-on-error: true