|
| 1 | +--- |
| 2 | +name: Update rust-analyzer |
| 3 | +emoji: 🦀 |
| 4 | +description: Update the rust-analyzer version used by the Rust extractor and prepare a pull request. |
| 5 | +intent: Keep the Rust extractor on the latest compatible rust-analyzer version with a reviewable, validated pull request. |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + roles: [admin, maintainer, write] |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + actions: read |
| 12 | + pull-requests: read |
| 13 | + copilot-requests: write |
| 14 | +strict: true |
| 15 | +checkout: |
| 16 | + fetch-depth: 0 |
| 17 | +concurrency: |
| 18 | + group: update-rust-analyzer |
| 19 | + cancel-in-progress: false |
| 20 | +timeout-minutes: 180 |
| 21 | +tools: |
| 22 | + github: |
| 23 | + mode: gh-proxy |
| 24 | + toolsets: [repos, pull_requests, actions] |
| 25 | + bash: ["*"] |
| 26 | + edit: true |
| 27 | +network: |
| 28 | + allowed: |
| 29 | + - defaults |
| 30 | + - github |
| 31 | + - github-actions |
| 32 | + - rust |
| 33 | + - bazel |
| 34 | + - python |
| 35 | +steps: |
| 36 | + - name: Configure Git |
| 37 | + run: | |
| 38 | + git config user.name "github-actions[bot]" |
| 39 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 40 | +
|
| 41 | + - name: Install cargo-edit |
| 42 | + continue-on-error: true |
| 43 | + run: cargo install cargo-edit@0.13.0 --locked |
| 44 | + |
| 45 | + - name: Run rust-analyzer updater script |
| 46 | + run: | |
| 47 | + mkdir -p /tmp/gh-aw/agent |
| 48 | + set +e |
| 49 | + python3 rust/scripts/update_rust_analyzer.py \ |
| 50 | + 2>&1 | tee /tmp/gh-aw/agent/rust-analyzer-update.log |
| 51 | + status=${PIPESTATUS[0]} |
| 52 | + set -e |
| 53 | +
|
| 54 | + printf '%s\n' "$status" > /tmp/gh-aw/agent/rust-analyzer-update-status.txt |
| 55 | + if grep -Fxq "No new rust-analyzer version available." \ |
| 56 | + /tmp/gh-aw/agent/rust-analyzer-update.log; then |
| 57 | + printf '%s\n' "no-update" > /tmp/gh-aw/agent/rust-analyzer-update-result.txt |
| 58 | + else |
| 59 | + printf '%s\n' "update" > /tmp/gh-aw/agent/rust-analyzer-update-result.txt |
| 60 | + fi |
| 61 | +safe-outputs: |
| 62 | + report-incomplete: {} |
| 63 | + create-pull-request: |
| 64 | + title-prefix: "Rust: " |
| 65 | + branch-prefix: "automation/update-rust-analyzer/" |
| 66 | + draft: true |
| 67 | + max-patch-size: 10240 |
| 68 | + max-patch-files: 1000 |
| 69 | + allowed-files: |
| 70 | + - "Cargo.lock" |
| 71 | + - "shared/tree-sitter-extractor/Cargo.toml" |
| 72 | + - "shared/yeast/Cargo.toml" |
| 73 | + - "shared/yeast-macros/Cargo.toml" |
| 74 | + - "shared/yeast-schema/Cargo.toml" |
| 75 | + - "ruby/extractor/Cargo.toml" |
| 76 | + - "unified/extractor/Cargo.toml" |
| 77 | + - "unified/swift-syntax-rs/Cargo.toml" |
| 78 | + # A rust-analyzer update can require a newer Rust toolchain whose Clippy |
| 79 | + # lints require compatibility fixes in any of the Rust sources. |
| 80 | + # rust-analyzer dependency updates can also update tree-sitter APIs, |
| 81 | + # requiring compatibility fixes in the shared extractor implementation. |
| 82 | + - "shared/yeast/src/**" |
| 83 | + - "shared/yeast-macros/src/**" |
| 84 | + - "shared/yeast-schema/src/**" |
| 85 | + - "shared/tree-sitter-extractor/src/**" |
| 86 | + - "MODULE.bazel" |
| 87 | + - "MODULE.bazel.lock" |
| 88 | + - "rust-toolchain.toml" |
| 89 | + - "rust/**" |
| 90 | + - "misc/bazel/3rdparty/**" |
| 91 | +--- |
| 92 | + |
| 93 | +# Update rust-analyzer |
| 94 | + |
| 95 | +## Task |
| 96 | + |
| 97 | +The workflow has already run `rust/scripts/update_rust_analyzer.py`. Read: |
| 98 | + |
| 99 | +- `/tmp/gh-aw/agent/rust-analyzer-update.log` for its complete output. |
| 100 | +- `/tmp/gh-aw/agent/rust-analyzer-update-status.txt` for its exit status. |
| 101 | +- `/tmp/gh-aw/agent/rust-analyzer-update-result.txt` for the deterministic result classification. |
| 102 | + |
| 103 | +If the result is `no-update`, call `noop` with the reason |
| 104 | +`No new rust-analyzer version available.` and stop immediately. Do not inspect |
| 105 | +CI, modify files, or create a pull request. |
| 106 | + |
| 107 | +Otherwise, continue the update from the existing working tree and commits: |
| 108 | + |
| 109 | +1. Read `rust/updating-rust-analyzer.md` and all applicable repository |
| 110 | + instructions. |
| 111 | +2. Review the updater log, exit status, commits, and working tree. Do not rerun |
| 112 | + the updater script. |
| 113 | +3. Complete as much of the documented update as possible. Fix extractor or |
| 114 | + code-generation breakage, keep all `ra_ap_` dependency versions aligned, |
| 115 | + regenerate required files, and add schema upgrade/downgrade scripts, tests, |
| 116 | + and a change note when the schema changed. |
| 117 | +4. Run the relevant formatting, linting, code generation, build, and tests, |
| 118 | + including `bazel run //rust:install`. Use `gh` to inspect relevant existing |
| 119 | + CI configuration and prior failures while diagnosing problems. |
| 120 | +5. Review the complete diff and commits. Do not include secrets. Do not refer |
| 121 | + to private repositories, internal issues, or internal pull requests in the |
| 122 | + public pull request. |
| 123 | +6. Use `create_pull_request` exactly once to create a focused draft pull |
| 124 | + request. Summarize the updater output, changes, and validation. If the |
| 125 | + update cannot be finished, still create a partial draft pull request when |
| 126 | + there are useful changes, and clearly list failures, missing work, and the |
| 127 | + next commands for a maintainer. |
| 128 | + |
| 129 | +The pull request is created after this agent execution, so its newly triggered |
| 130 | +CI cannot be awaited in this run. Compensate with the strongest practical |
| 131 | +local validation and state this limitation accurately in the pull request. |
| 132 | +If the updater did not report `no-update` but no useful patch can be produced, |
| 133 | +call `report_incomplete` with the updater failure and exact blocker. |
| 134 | + |
| 135 | +## Safe Outputs |
| 136 | + |
| 137 | +- Use `create_pull_request` for the update or partial update. |
| 138 | +- Use `noop` only for the exact no-update result. |
| 139 | +- Use `report_incomplete` only when no useful pull request can be created. |
0 commit comments