Skip to content

Commit 8f1a4d4

Browse files
add option to call fetch-source with --github-comment (#556)
1 parent 3420056 commit 8f1a4d4

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

swift-ci/sdks/android/scripts/fetch-source.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ usage: fetch-source.sh [--swift-scheme <scheme>|--swift-tag <tag>
6767
[--boringssl-version <version>]
6868
[--clone-with-ssh]
6969
[--source-dir <path>]
70+
[--github-comment <comment>]
7071
7172
Fetch all the sources required to build the fully statically linked Linux
7273
SDK for Swift. Options are:
@@ -82,6 +83,10 @@ SDK for Swift. Options are:
8283
select a scheme or tag; otherwise it will be treated as
8384
a version number.
8485
--boringssl-version <version>
86+
--github-comment <comment>
87+
GitHub PR comment body to pass to update-checkout via
88+
--github-comment, used to select specific repos to check
89+
out from a pull request comment.
8590
EOF
8691
}
8792

@@ -94,6 +99,7 @@ if [[ -z "${BORINGSSL_VERSION}" ]]; then
9499
fi
95100

96101
clone_with_ssh=false
102+
github_comment=""
97103
while [ "$#" -gt 0 ]; do
98104
case "$1" in
99105
--swift-scheme)
@@ -108,6 +114,8 @@ while [ "$#" -gt 0 ]; do
108114
clone_with_ssh=true ;;
109115
--source-dir)
110116
source_dir="$2"; shift ;;
117+
--github-comment)
118+
github_comment="$2"; shift ;;
111119
*)
112120
usage; exit 0 ;;
113121
esac
@@ -142,13 +150,16 @@ cd swift
142150
# Get its dependencies
143151
header "Fetching Swift Dependencies"
144152

145-
extra_args="--skip-history --all-repositories"
153+
extra_args=(--skip-history --all-repositories)
154+
if [[ -n "$github_comment" ]]; then
155+
extra_args+=(--github-comment "$github_comment")
156+
fi
146157
if [[ $SWIFT_VERSION == scheme:* ]]; then
147-
utils/update-checkout ${clone_arg} --scheme ${SWIFT_VERSION#scheme:} ${extra_args}
158+
utils/update-checkout ${clone_arg} --scheme ${SWIFT_VERSION#scheme:} "${extra_args[@]}"
148159
elif [[ $SWIFT_VERSION == tag:* ]]; then
149-
utils/update-checkout ${clone_arg} --tag ${SWIFT_VERSION#tag:} ${extra_args}
160+
utils/update-checkout ${clone_arg} --tag ${SWIFT_VERSION#tag:} "${extra_args[@]}"
150161
else
151-
utils/update-checkout ${clone_arg} --tag swift-${SWIFT_VERSION}-RELEASE ${extra_args}
162+
utils/update-checkout ${clone_arg} --tag swift-${SWIFT_VERSION}-RELEASE "${extra_args[@]}"
152163
fi
153164

154165
popd >/dev/null

0 commit comments

Comments
 (0)