Skip to content

Commit

Permalink
Merge pull request #5 from huitseeker/rust-version-check
Browse files Browse the repository at this point in the history
feat: add a workflow that checks for rust version drift
  • Loading branch information
huitseeker committed Jan 4, 2024
2 parents 96e567f + 27115ab commit fc8fe52
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/VERSION_CHECK.md
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`.
46 changes: 46 additions & 0 deletions .github/workflows/rust-version-check.yml
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

0 comments on commit fc8fe52

Please sign in to comment.