forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate
More file actions
executable file
·39 lines (27 loc) · 1.21 KB
/
update
File metadata and controls
executable file
·39 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -e
export GO111MODULE=on
# Can specify a SHA pushed to our fork instead of master
version="${1:-main}"
name="sourcegraph/zoekt"
repo="github.com/${name}"
response="$(mktemp)"
trap 'rm -f "$response"' EXIT
curl --silent --fail "https://api.github.com/repos/${name}/commits?per_page=1&sha=${version}" >"${response}"
newsha="$(jq -r '.[0].sha[:12]' <"${response}")"
oldsha="$(go mod edit -print | grep "$repo" | grep -o '[a-f0-9]*$')"
echo "https://$repo/compare/$oldsha...$newsha"
curl --silent --fail "https://api.github.com/repos/sourcegraph/zoekt/compare/$oldsha...$newsha" >"${response}"
echo
jq -r '.commits[] | "- https://github.com/sourcegraph/zoekt/commit/" + .sha[:10] + " " + (.commit.message | split("\n")[0])' <"${response}" |
sed 's/ (#[0-9]*)//g'
echo
jq -r '.commits[] | "- " + .sha[:10] + " " + (.commit.message | split("\n")[0])' <"${response}" |
sed 's/ (#[0-9]*)//g'
echo
go get "${repo}@${version}"
go mod download ${repo}
go mod tidy
echo "Ensure we update go.sum by actually compiling some code which depends on zoekt."
echo "We do this by running 'go test' without actually running any tests."
go test -run '^$' github.com/sourcegraph/sourcegraph/internal/search/zoekt