forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathverify-channel.sh
executable file
·38 lines (32 loc) · 1.02 KB
/
verify-channel.sh
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
#!/bin/bash
# We want to make sure all PRs are targeting the right branch when they're
# opened, otherwise we risk (for example) to land a beta-specific change to the
# master branch. This script ensures the branch of the PR matches the channel.
set -euo pipefail
IFS=$'\n\t'
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
if isCiBranch auto || isCiBranch try || isCiBranch try-perf || isCiBranch automation/bors/try; then
echo "channel verification is only executed on PR builds"
exit
fi
channel=$(cat "$(ciCheckoutPath)/src/ci/channel")
case "${channel}" in
nightly)
channel_branch="master"
;;
beta)
channel_branch="beta"
;;
stable)
channel_branch="stable"
;;
*)
echo "error: unknown channel defined in src/ci/channel: ${channel}"
exit 1
esac
branch="$(ciBaseBranch)"
if [[ "${branch}" != "${channel_branch}" ]]; then
echo "error: PRs changing the \`${channel}\` channel should be sent to the \
\`${channel_branch}\` branch!"
exit 1
fi