From 49d43ed604daacffdddb31686927535723d9f499 Mon Sep 17 00:00:00 2001 From: Dani Akash Date: Fri, 23 Oct 2026 12:34:45 +0530 Subject: [PATCH 1/2] ci(website): grant Pages write access only to the deploy job The build job runs dependency installs and the Astro build on pull request code, so it no longer receives pages: write or id-token: write. The workflow defaults to contents: read and only the deploy job, which never runs on pull requests, gets the Pages permissions. --- .github/workflows/pages.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 }} From ab8d0cfc7a04b0455ec73488f9e6b3ba66529691 Mon Sep 17 00:00:00 2001 From: Dani Akash Date: Fri, 23 Oct 2026 12:34:45 +0530 Subject: [PATCH 2/2] fix(website): make kit removal keep the user's own config files The removal command deleted rustfmt.toml, AGENTS.md and the other files unconditionally, even though setup skips files that already exist. It now deletes a file only if it is byte-identical to the kit's published version. It removes CLAUDE.md only when it is a symlink to a removed AGENTS.md, and it tells users to remove a merged AGENTS.md section by hand. Reverting the adoption commit is suggested first. The FAQ answer points to the same safe path. --- website/src/content/docs/faq.md | 2 +- website/src/content/docs/quick-start.mdx | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) 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