Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/daily-grammar-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Daily Grammar Check
on:
schedule:
# Run at 4am UTC every day
- cron: '0 4 * * *'
workflow_dispatch:

jobs:
grammar-check:
if: github.repository == 'rust-lang/reference'
runs-on: ubuntu-latest
steps:
- name: Checkout reference repository
uses: actions/checkout@v7

- name: Checkout rust-lang/rust (shallow clone)
uses: actions/checkout@v7
with:
repository: rust-lang/rust
path: rust
fetch-depth: 1

- name: Update rustup
run: rustup self update

- name: Install Rust nightly
run: |
rustup set profile minimal
rustup toolchain install nightly -c rustc-dev -c llvm-tools
rustup default nightly

- name: Report versions
run: |
rustup --version
rustc -Vv

- name: Run grammar check
id: grammar-check
continue-on-error: true
run: |
cargo run --release -p grammar-check -- lex-compare --path rust
cargo run --release -p grammar-check -- lex-compare --permute Token

- name: Check for existing open issues
if: steps.grammar-check.outcome == 'failure'
id: check-issues
env:
GH_TOKEN: ${{ github.token }}
run: |
# Check if there's already an open issue with the label 'daily-grammar-check'
ISSUE_COUNT=$(gh issue list --label "daily-grammar-check" --state open --json number --jq 'length')
echo "open_issues=$ISSUE_COUNT" >> $GITHUB_OUTPUT

- name: Create issue on failure
if: steps.grammar-check.outcome == 'failure' && steps.check-issues.outputs.open_issues == '0'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue create \
--title "Daily Grammar Check Failed - $(date +%Y-%m-%d)" \
--label "daily-grammar-check" \
--body "The daily grammar check failed on $(date +%Y-%m-%d).

**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

**Command:** \`cargo run --release -p grammar-check -- lex-compare --path rust/tests\`

Please investigate the failure and update the reference as needed.

This issue was automatically created by the daily grammar check workflow."
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ jobs:
run: |
rustup --version
rustc -Vv

tools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust nightly
run: |
rustup set profile minimal
rustup toolchain install nightly -c rustc-dev -c llvm-tools
rustup default nightly
- name: Report versions
run: |
rustup --version
rustc -Vv
- name: Verify tools workspace lockfile is current
run: cargo update -p mdbook-spec --locked
- name: Test tools
Expand Down Expand Up @@ -165,6 +181,7 @@ jobs:
- code-tests
- style-tests
- mdbook-spec
- tools
- dev-guide
# preview is explicitly excluded here since it doesn't run on merge
runs-on: ubuntu-latest
Expand Down
Loading
Loading