Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GitHub Diff Defaults

Chrome extension that applies preferred URL settings whenever a GitHub pull request's Changes tab opens.

The extension button opens a small settings panel. All options are off by default, and your choices are saved in Chrome Sync. The extension reapplies your chosen filters after GitHub's internal navigations.

  • w=1 — hide whitespace-only changes;
  • show-viewed-files=false — do not show files already marked as viewed.

Other query parameters, such as diff=split, and URL hashes are retained. The extension affects only URLs shaped like https://github.com/<owner>/<repo>/pull/<number>/changes (and the older /files route).

Marking files as viewed

  • Press v on a Changes page to mark the first not-viewed file on screen as viewed. With viewed files hidden, the next file moves up, so v can be pressed repeatedly while scrolling.
  • Auto-mark import-only files as viewed (off by default) marks files whose every changed line is an import.
  • Auto-mark unchanged renames as viewed (off by default) marks files GitHub labels File renamed without changes.

The extension marks up to one file per second across both options and picks up new diffs as they load. A file unmarked by hand stays unmarked until the page reloads.

Install locally

  1. Run npm run build.
  2. Open chrome://extensions in Chrome and enable Developer mode.
  3. Choose Load unpacked and select the project's dist/ folder.

Verify

Enable Hide whitespace changes and Hide viewed files, then open a pull request's Changes tab. Its URL should include:

?w=1&show-viewed-files=false

Run the tests with:

npm test

Build a distributable package

npm run build

The unpacked distributable is written to dist/. GitHub Actions additionally uploads this folder for every CI run and builds a ZIP for every v* tag.

Release

Every update to main, including a PR merge, runs the release workflow. Use a Conventional Commit title when merging a PR. The workflow uses the highest applicable bump across the incoming commits:

  • feat!: or a BREAKING CHANGE: footer increments the major version.
  • feat: increments the minor version.
  • fix:, other types, and plain titles increment the patch version.

The workflow sets the version in the build, tags the source commit, attaches the ZIP to a GitHub Release, and submits it to the Chrome Web Store for review. Google's review usually takes a few days.

If the Chrome Web Store step fails after the GitHub Release was created, fix the cause and re-run the failed job (gh run rerun <run-id> --failed). The job uses the same version on retry. To run the workflow for the current main manually, use gh workflow run release.yml --ref main.

One-time setup

The API only updates an existing item, so the very first version is uploaded by hand in the Developer Dashboard. Then, in the Google Cloud project chrome-extensions-511619:

  1. Enable the Chrome Web Store API and the IAM Service Account Credentials API; the latter is what google-github-actions/auth uses to mint the access token.
  2. Create a service account (cws-publisher) and download a JSON key for it.
  3. Grant that service account Service Account Token Creator; without it the auth step fails with iam.serviceAccounts.getAccessToken denied. New IAM grants can take a few minutes to apply.
  4. Add the service account's email in the Developer Dashboard under Account → Service account.

Repository secrets:

  • GCP_SA_KEY: the service account's JSON key.
  • CWS_PUBLISHER_ID: the publisher ID, the UUID in Developer Dashboard URLs (devconsole/<publisher-id>/<extension-id>/...).
  • CWS_EXTENSION_ID: the extension's item ID.

Privacy

See PRIVACY.md. The extension does not collect or transmit personal data.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages