forked from dotnet/source-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch-vsts-commits.sh
More file actions
executable file
·49 lines (38 loc) · 922 Bytes
/
fetch-vsts-commits.sh
File metadata and controls
executable file
·49 lines (38 loc) · 922 Bytes
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
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
remote_ref_name=${remote_ref_name:-vsts}
pat="${1:-}"
if [ -z "$pat" ]; then
echo "usage: $0 <pat>"
echo ""
echo "The PAT should be a devdiv.visualstudio.com VSTS PAT."
echo "Get one at https://devdiv.visualstudio.com/_details/security/tokens."
echo ""
exit 1
fi
get_vsts_url() {
name=$1
instance=${2:-devdiv.visualstudio.com}
project=${3:-DevDiv}
echo "https://usernameplaceholder:${pat}@${instance}/${project}/_git/${name}/"
}
fetch() {
name=$1
remote=$2
(
cd "$SCRIPT_ROOT/src/$name"
git fetch "$remote" +refs/heads/*:refs/remotes/${remote_ref_name}/*
)
}
fetch_vsts() {
name=$1
url=${2:-$(get_vsts_url "DotNet-$name-Trusted")}
fetch "$name" "$url"
}
set -x
fetch_vsts cli
fetch_vsts core-setup
fetch_vsts coreclr
fetch_vsts corefx