-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from huitseeker/rust-version-check
feat: add a workflow that checks for rust version drift
- Loading branch information
Showing
2 changed files
with
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "chore: rust toolchain needs an upgrade" | ||
labels: debt, automated-issues | ||
--- | ||
|
||
The rust version specified in `rust-toolchain.toml` is out of date with the latest stable. | ||
|
||
Check the [rust version check]({{env.WORKFLOW_URL}}) workflow for details. | ||
|
||
This issue was raised by the workflow at `https://github.com/lurk-lab/ci-workflows/tree/main/.github/workflows/rust-version-check.yml`. |
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,46 @@ | ||
name: Rust Version Check | ||
|
||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
rust-version-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Get Local Rust Version | ||
id: get-rust-version | ||
run: echo "RUST_VERSION=$(rustc --version | awk '{print $2}')" >> $GITHUB_ENV | ||
|
||
- name: Parse rust-toolchain.toml | ||
id: parse-toolchain | ||
run: | | ||
CHANNEL=$(awk -F'\"' '/channel/ {print $2}' rust-toolchain.toml) | ||
if [[ $CHANNEL =~ ^[0-9]+\.[0-9]+$ ]]; then | ||
echo "TOOLCHAIN_VERSION=$CHANNEL" >> $GITHUB_ENV | ||
else | ||
echo "TOOLCHAIN_VERSION=stable" >> $GITHUB_ENV | ||
fi | ||
- name: Compare Rust Versions | ||
id: compare-versions | ||
run: | | ||
if [[ $TOOLCHAIN_VERSION != "stable" && $TOOLCHAIN_VERSION < $RUST_VERSION ]]; then | ||
echo "VERSION_MISMATCH=true" >> $GITHUB_ENV | ||
else | ||
echo "VERSION_MISMATCH=false" >> $GITHUB_ENV | ||
- uses: JasonEtco/create-an-issue@v2 | ||
if: env.VERSION_MISMATCH == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
with: | ||
update_existing: true | ||
filename: .github/VERSION_CHECK.md |