Skip to content

Commit

Permalink
Diff changes to dist for all PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Nov 27, 2023
1 parent 903fdf8 commit 9661583
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/diff-change-to-dist.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
name: Diff changes to dist

on:
pull_request:
paths: ['dist/**']

permissions:
pull-requests: write
workflow_call:
workflow_dispatch:

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 }}
# 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/checkout@v4.1.1
with:
fetch-depth: 0 # Need to also checkout the base branch to compare

- name: Install dependencies
- name: Restore dependencies
uses: ./.github/workflows/actions/install-node

- name: Restore build
uses: ./.github/workflows/actions/build

- name: Set up diff drivers
run: |
npm install -g js-beautify
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,17 @@ jobs:
uses: ./.github/workflows/screenshots.yml
secrets: inherit

generate-diff:
name: Diff changes to dist
needs: [install, build]

permissions:
pull-requests: write

# Run existing "Diff changes to dist" workflow
# (after install and build have been cached)
uses: ./.github/workflows/diff-change-to-dist.yaml

generate-stats:
name: Stats comment
needs: [install, build]
Expand Down

0 comments on commit 9661583

Please sign in to comment.