You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
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
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
The text was updated successfully, but these errors were encountered:
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
What
Using GitHub Actions, automatically post a prettified git diff of the
dist
folder on pull requests that update thedist
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/
Install
js-beautify
Define two new diff drivers in the user's .gitconfig:
Configure git to use the diff driver for minified CSS and JS by adding to the
.gitattributes
file in the repo:Run
git diff
against themaster
branch for thedist
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)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 aminjs
ormincss
diff driver.Done when
diff
The text was updated successfully, but these errors were encountered: