forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: error out if someone sends a PR to the wrong branch
- Loading branch information
1 parent
81a97ce
commit 392723e
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/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" | ||
|
||
declare -A CHANNEL_BRANCH | ||
CHANNEL_BRANCH["nightly"]="master" | ||
CHANNEL_BRANCH["beta"]="beta" | ||
CHANNEL_BRANCH["stable"]="stable" | ||
|
||
if isCiBranch auto || isCiBranch try; then | ||
echo "channel verification is only executed on PR builds" | ||
exit | ||
fi | ||
|
||
channel=$(cat "$(ciCheckoutPath)/src/ci/channel") | ||
branch="$(ciBaseBranch)" | ||
if [[ "${branch}" != "${CHANNEL_BRANCH[$channel]}" ]]; then | ||
echo "error: PRs changing the \`${channel}\` channel should be sent to the \ | ||
\`${CHANNEL_BRANCH[$channel]}\` branch!" | ||
|
||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters