diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c792bd5..1ed86b1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -28,10 +28,9 @@ on: - .github/workflows/pages.yml workflow_dispatch: +# Builds run code from pull requests, so only the deploy job gets Pages write access. permissions: contents: read - pages: write - id-token: write concurrency: group: pages-${{ github.ref }} @@ -55,6 +54,9 @@ jobs: if: github.event_name != 'pull_request' needs: build runs-on: ubuntu-latest + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/website/src/content/docs/faq.md b/website/src/content/docs/faq.md index c297f49..31a3fb4 100644 --- a/website/src/content/docs/faq.md +++ b/website/src/content/docs/faq.md @@ -42,7 +42,7 @@ No. It is an unofficial community project, not affiliated with or endorsed by Go ## How do I remove it? -Delete `rustfmt.toml`, `clippy.toml`, `deny.toml`, `rust-toolchain.toml` and `AGENTS.md` (and a `CLAUDE.md` link if you made one), then remove the lint tables from `Cargo.toml`. The [quick start](/Google-Rust-Style-Guide/quick-start/#remove-the-kit) shows the exact commands. +Revert the commit that added it, or run the removal script in the [quick start](/Google-Rust-Style-Guide/quick-start/#remove-the-kit). The script deletes only config files that are still identical to the kit's versions, so your own files are never touched. Then remove the lint tables from `Cargo.toml`. ## How is the kit kept correct? diff --git a/website/src/content/docs/quick-start.mdx b/website/src/content/docs/quick-start.mdx index 6476af7..3b4a032 100644 --- a/website/src/content/docs/quick-start.mdx +++ b/website/src/content/docs/quick-start.mdx @@ -217,13 +217,22 @@ jobs: ## Remove the kit -Changed your mind? Delete the five files and the lint tables: +Changed your mind? If you added the kit in its own commit, reverting that commit is the cleanest way out. Otherwise, run this from your project root. It only deletes files that are still identical to the kit's versions, so your own config files and any you edited are kept: ```sh title="Terminal" -rm rustfmt.toml clippy.toml deny.toml rust-toolchain.toml AGENTS.md CLAUDE.md +base=https://daniakash.github.io/Google-Rust-Style-Guide/files +for f in rustfmt.toml clippy.toml deny.toml rust-toolchain.toml AGENTS.md; do + if [ -f "$f" ] && curl -fsSL "$base/$f" | cmp -s - "$f"; then rm "$f"; echo "removed $f" + elif [ -e "$f" ]; then echo "kept $f (not the kit's version)"; fi +done +if [ -L CLAUDE.md ] && [ "$(readlink CLAUDE.md)" = AGENTS.md ] && [ ! -e AGENTS.md ]; then rm CLAUDE.md; fi ``` -Then remove everything from the `# Google Rust Style Guide lints` comment to the end of your `Cargo.toml`, and the `[lints] workspace = true` lines from member crates. +Then finish by hand: + +- In `Cargo.toml`, delete everything from the `# Google Rust Style Guide lints` comment to the end of the file, and remove `[lints] workspace = true` from member crates if you added it. +- If you pasted the kit's rules into an existing `AGENTS.md` instead of downloading it, delete that section. +- Files reported as "kept" are either yours or edited since you downloaded them. Remove them only if you are sure. ## Next steps