Pre-release v5.0.0-beta.1 #164
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Diff changes to dist | |
on: | |
pull_request: | |
paths: ['dist/**'] | |
permissions: | |
pull-requests: write | |
jobs: | |
generate-diff: | |
name: Generate diff | |
runs-on: ubuntu-latest | |
# Skip when token write permissions are unavailable on forks | |
if: ${{ !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 | |
git config diff.mincss.textconv js-beautify | |
- name: Generate diff | |
id: 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 distribution diffs | |
uses: actions/[email protected] | |
with: | |
name: Dist diff | |
path: 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 }}/dist-js.diff', | |
titleText: 'JavaScript changes to `dist`', | |
markerText: 'dist-diff-js' | |
}, | |
{ | |
path: '${{ github.workspace }}/dist-css.diff', | |
titleText: 'Stylesheets changes to `dist`', | |
markerText: 'dist-diff-css' | |
}, | |
{ | |
path: '${{ github.workspace }}/dist-other.diff', | |
titleText: 'Other changes to `dist`', | |
markerText: 'dist-diff-other' | |
} | |
] | |
await commentDiffs({ github, context, commit }, issueNumber, diffs) |