Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate posting a diff of changes to the dist folder when creating a new release #2054

Closed
1 task
36degrees opened this issue Dec 2, 2020 · 0 comments · Fixed by #2082
Closed
1 task
Assignees
Labels

Comments

@36degrees
Copy link
Contributor

What

Using GitHub Actions, automatically post a prettified git diff of the dist folder on pull requests that update the dist folder.

Why

We've got in the habit of doing this as part of our release process, as it allows us to review the (minfied) changes to the dist folder, checking that they're what we expect.

For example, see the diff for the dist folder for v3.10.0.

However, this requires us to remember that we need to do it, and is a fairly manual process.

Who needs to know about this

Developers

Further detail

The current process uses the approach outlined here to prettify the minified JS / CSS before diffing it:
https://scripter.co/git-diff-minified-js-and-css/

  1. Install js-beautify

  2. Define two new diff drivers in the user's .gitconfig:

    [diff "minjs"]
        textconv = js-beautify
        cachetextconv = true
    [diff "mincss"]
        textconv = js-beautify --css
        cachetextconv = true
    
  3. Configure git to use the diff driver for minified CSS and JS by adding to the .gitattributes file in the repo:

    *.min.js diff=minjs
    *.min.css diff=mincss
    
  4. Run git diff against the master branch for the dist folder (using -M to detect renames with a similarity of 10% seems to work reliably so that git doesn't see the rename as a deletion and an addition)

    git diff -M1 master dist
    
  5. Paste the output on the PR, using diff for syntax highlighting.

We should try and automate this, whilst ensuring that git diff continues to work for users without having to install or configure anything. For example, we should check whether committing the .gitattributes file to the repo would cause issues for users without a minjs or mincss diff driver.

Done when

  • Prettified diffs are automatically posted on PRs that update files in diff
@36degrees 36degrees added awaiting triage Needs triaging by team tooling labels Dec 2, 2020
@36degrees 36degrees changed the title Automate posting a prettified diff of changes to the dist folder when creating a new release Automate posting a diff of changes to the dist folder when creating a new release Dec 2, 2020
@trang-erskine trang-erskine added 🕔 days and removed awaiting triage Needs triaging by team labels Dec 7, 2020
@36degrees 36degrees self-assigned this Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants