-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: detect the channel a PR wants to merge into #12181
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,50 @@ | ||
#!/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 --version-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" | ||
elif [[ "$ref" = "$beta" ]] | ||
then | ||
channel="beta" | ||
else | ||
channel="stable" | ||
fi | ||
|
||
echo "Base sha: $base_sha" | ||
echo "Git Ref: $ref" | ||
echo "master: $master" | ||
echo "beta: $beta" | ||
echo "Channel: $channel" | ||
|
||
echo "CHANNEL=$channel" >> "$GITHUB_OUTPUT" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this have a comment explaining roughly what it is doing? It's not too hard to follow, but just a high-level description could help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Let me know if it is clear enough.