-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: detect the channel a PR wants to merge into
- Loading branch information
Showing
3 changed files
with
140 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"name": "Linux x86_64 stable", | ||
"os": "ubuntu-latest", | ||
"rust": "stable", | ||
"other": "i686-unknown-linux-gnu" | ||
}, | ||
{ | ||
"name": "Linux x86_64 beta", | ||
"os": "ubuntu-latest", | ||
"rust": "beta", | ||
"other": "i686-unknown-linux-gnu" | ||
}, | ||
{ | ||
"name": "Linux x86_64 nightly", | ||
"os": "ubuntu-latest", | ||
"rust": "nightly", | ||
"other": "i686-unknown-linux-gnu" | ||
}, | ||
{ | ||
"name": "macOS x86_64 stable", | ||
"os": "macos-latest", | ||
"rust": "stable", | ||
"other": "x86_64-apple-ios" | ||
}, | ||
{ | ||
"name": "macOS x86_64 nightly", | ||
"os": "macos-latest", | ||
"rust": "nightly", | ||
"other": "x86_64-apple-ios" | ||
}, | ||
{ | ||
"name": "Windows x86_64 MSVC stable", | ||
"os": "windows-latest", | ||
"rust": "stable-msvc", | ||
"other": "i686-pc-windows-msvc" | ||
}, | ||
{ | ||
"name": "Windows x86_64 gnu nightly", | ||
"os": "windows-latest", | ||
"rust": "nightly-gnu", | ||
"other": "i686-pc-windows-gnu" | ||
} | ||
] |
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,47 @@ | ||
#!/bin/bash | ||
# This script outputs the channel where a CI workflow wants to merge into. | ||
# | ||
# Inputs: | ||
# BASE_SHA The commit SHA of the branch where the PR wants to merge into. | ||
# | ||
# GitHub Action Outputs: | ||
# CHANNEL Target channel where the PR wants to merge into. | ||
|
||
set -euo pipefail | ||
|
||
# When `BASE_SHA` is missing, we assume it is from bors merge commit, | ||
# so hope `HEAD~` to find the previous commit on master branch. | ||
base_sha=$(git rev-parse "${BASE_SHA:-HEAD~1}") | ||
|
||
# Get symbolic names for the base_sha. | ||
# Assumption: Cargo branches are always in the format of `rust-1.*.0`, | ||
# otherwise `git name-rev` will return "undefined". | ||
ref=$(git name-rev --name-only --refs='origin/rust-1.*.0' $base_sha) | ||
|
||
# Get the latest `rust-1.*.0` branch from remote origin. | ||
# Assumption: The latest branch is always beta branch. | ||
beta=$(git branch --remotes --list 'origin/rust-1.*.0' | sort | tail -n1 | tr -d "[:space:]") | ||
|
||
master=$(git rev-parse origin/master) | ||
|
||
# Backport pull requests always target at a `rust-1.*.0` branch. | ||
if [[ "$ref" = "undefined" ]] || [[ "$base_sha" = "$master" ]] | ||
then | ||
# Should be nightly but for convenience in CI let's call it master. | ||
channel="master" | ||
else | ||
if [[ "$ref" = "$beta" ]] | ||
then | ||
channel="beta" | ||
else | ||
channel="stable" | ||
fi | ||
fi | ||
|
||
echo "Base sha: $base_sha" | ||
echo "Git Ref: $ref" | ||
echo "master: $master" | ||
echo "beta: $beta" | ||
echo "Channel: $channel" | ||
|
||
echo "CHANNEL=$channel" >> "$GITHUB_OUTPUT" |