Skip to content

Release v5.7.1

Release v5.7.1 #188

name: Diff changes to GitHub release
on:
pull_request:
paths: ['dist/**']
permissions:
pull-requests: write
jobs:
generate-diff:
name: Generate diff
runs-on: ubuntu-latest
# Skip workflows other than PRs such as merges to `main` but
# also when token write permissions are unavailable on forks
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Need to also checkout the base branch to compare
- name: Install dependencies
uses: ./.github/workflows/actions/install-node
- name: Set up diff drivers
run: |
npm install -g js-beautify
git config diff.minjs.textconv "js-beautify --editorconfig --type js"
git config diff.mincss.textconv "js-beautify --editorconfig --type css"
- name: Generate diff
run: |
# Using `origin/$GITHUB_BASE_REF` to avoid actually checking out the branch
# as all we need is to let Git diff the two references
bin/dist-diff.sh origin/$GITHUB_BASE_REF $GITHUB_WORKSPACE
- name: Save GitHub release diffs
uses: actions/[email protected]
with:
name: GitHub release diffs
path: .cache/diff/dist/*.diff
if-no-files-found: ignore
- name: Add comment to PR
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { commentDiffs } = await import('${{ github.workspace }}/.github/workflows/scripts/comments.mjs')
// PR information
const issueNumber = ${{ github.event.pull_request.number }}
const commit = '${{ github.event.pull_request.head.sha }}'
const diffs = [
{
path: '${{ github.workspace }}/.cache/diff/dist/js.diff',
titleText: 'JavaScript changes to GitHub release',
markerText: 'dist/js.diff'
},
{
path: '${{ github.workspace }}/.cache/diff/dist/css.diff',
titleText: 'Stylesheets changes to GitHub release',
markerText: 'dist/css.diff'
},
{
path: '${{ github.workspace }}/.cache/diff/dist/other.diff',
titleText: 'Other changes to GitHub release',
markerText: 'dist/other.diff',
skipEmpty: true
}
]
await commentDiffs({ github, context, commit }, issueNumber, diffs)