Release v3.15.0 #169
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/**'] | |
jobs: | |
generate-diff: | |
name: Generate Diff | |
runs-on: ubuntu-latest | |
# Abort if run from a fork, as token won't have write access to post comment | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Need to also checkout the base branch to compare | |
- uses: actions/setup-node@v1 | |
- 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: | | |
git diff -M05 origin/$GITHUB_BASE_REF -- dist \ | |
> $GITHUB_WORKSPACE/dist.diff | |
- name: Add comment to PR | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs').promises | |
const diff = await fs.readFile( | |
process.env.GITHUB_WORKSPACE + '/dist.diff', 'utf8' | |
) | |
const commentText = '## Changes to dist\n' + | |
'```diff\n' + | |
diff + | |
'\n```' | |
github.issues.createComment({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: commentText | |
}) |