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
8 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
8
fetch-bangs:
9
9
runs-on: ubuntu-latest
10
10
steps:
11
11
-
- uses: actions/checkout@v3
11
11
+
- name: Checkout repository
12
12
+
uses: actions/checkout@v3
13
13
+
with:
14
14
+
fetch-depth: 1
12
15
13
16
- name: Install bun
14
17
uses: oven-sh/setup-bun@v1
···
30
33
31
34
- name: Replace bangs.json
32
35
run: |
33
33
-
mkdir -p src
36
36
+
mkdir -p src/bangs
34
37
mv bangs.json src/bangs/bangs.json
35
38
36
39
- name: 🥔 hash
37
40
run: bun run hash
38
41
39
39
-
- name: Commit changes
42
42
+
- name: Configure Git
40
43
run: |
41
44
git config --local user.email "github-actions[bot]@users.noreply.github.com"
42
45
git config --local user.name "github-actions[bot]"
46
46
+
47
47
+
- name: Check for changes and commit
48
48
+
id: check_changes
49
49
+
run: |
43
50
git add src/bangs/bangs.json src/bangs/hashbang.ts
44
44
-
45
45
-
# Check if the last commit was a bangs update
46
46
-
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
47
47
-
if [[ "$LAST_COMMIT_MSG" == "chore: update bangs.json" ]]; then
48
48
-
# If it was, amend the commit
49
49
-
git commit --amend -m "chore: update bangs.json" || exit 0
51
51
+
52
52
+
# Check if there are changes to commit
53
53
+
if git diff --staged --quiet; then
54
54
+
echo "No changes to commit"
55
55
+
echo "has_changes=false" >> $GITHUB_OUTPUT
56
56
+
exit 0
57
57
+
fi
58
58
+
59
59
+
echo "Changes detected in bangs files"
60
60
+
echo "has_changes=true" >> $GITHUB_OUTPUT
61
61
+
62
62
+
# Look for bangs update commits in history
63
63
+
git fetch origin main --unshallow
64
64
+
65
65
+
# Check if previous commit was a bangs update
66
66
+
PREV_COMMIT_MSG=$(git log -1 --pretty=%B)
67
67
+
if [[ "$PREV_COMMIT_MSG" == "chore: update bangs.json" ]]; then
68
68
+
# Amend the previous commit
69
69
+
git commit --amend -m "chore: update bangs.json"
70
70
+
else
71
71
+
# Create a new commit
72
72
+
git commit -m "chore: update bangs.json"
73
73
+
fi
74
74
+
75
75
+
# Push to main - using force only if we amended
76
76
+
if [[ "$PREV_COMMIT_MSG" == "chore: update bangs.json" ]]; then
77
77
+
git push --force-with-lease origin main
50
78
else
51
51
-
# Otherwise, create a new commit
52
52
-
git commit -m "chore: update bangs.json" || exit 0
79
79
+
git push origin main
53
80
fi
54
81
55
55
-
git push --force-with-lease
56
56
-
57
57
-
- name: Tailscale
82
82
+
# Handle Tangled push only if we have new changes
83
83
+
- name: Setup Tailscale
84
84
+
if: steps.check_changes.outputs.has_changes == 'true'
58
85
uses: tailscale/github-action@v3
59
86
with:
60
87
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
61
88
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
62
89
tags: tag:ci
63
90
64
64
-
- name: Add remote
65
65
-
run: git remote add tangled git@ember:did:plc:krxbvxvis5skq7jj6eot23ul/unduckified
66
66
-
67
67
-
- name: Configure ssh
91
91
+
- name: Configure SSH
92
92
+
if: steps.check_changes.outputs.has_changes == 'true'
68
93
run: |
69
94
mkdir -p ~/.ssh
70
95
echo "StrictHostKeyChecking no" >> ~/.ssh/config
71
96
72
72
-
- name: Push to tangled
73
73
-
run: git push tangled main
97
97
+
- name: Push to Tangled
98
98
+
if: steps.check_changes.outputs.has_changes == 'true'
99
99
+
run: |
100
100
+
git remote add tangled git@ember:did:plc:krxbvxvis5skq7jj6eot23ul/unduckified || true
101
101
+
git push tangled main
102
102
+
continue-on-error: true