Store controls in state #3032
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: WordPress Dependencies Report | |
on: | |
pull_request: | |
jobs: | |
build-trunk: | |
runs-on: ubuntu-latest | |
name: Build trunk for Dependencies Report | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: trunk | |
- shell: bash | |
name: Get trunk latest commit | |
id: trunk-commit | |
run: | | |
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: dist-cache | |
with: | |
path: ${{ github.workspace }}/assets/dist | |
key: ${{ runner.os }}-dist-${{ steps.trunk-commit.outputs.commit }} | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
- name: Get npm cache directory | |
id: npm-cache | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install JS dependencies | |
run: npm ci | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
- name: Create default dist folder | |
run: mkdir -p ${{ github.workspace }}/assets/dist && echo "{}" > ${{ github.workspace }}/assets/dist/assets.json | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
- name: Build Combined Assets for Trunk | |
run: npm run build:combine-assets | |
if: steps.dist-cache.outputs.cache-hit != 'true' | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: combined-assets | |
path: ${{ github.workspace }}/assets/dist | |
dependencies-report: | |
needs: [ build-trunk ] | |
name: WordPress Dependencies Report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get npm cache directory | |
id: npm-cache | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install JS dependencies | |
run: npm ci | |
- name: Build Combined Assets | |
run: npm run build:combine-assets | |
- name: Download assets (trunk) | |
uses: actions/download-artifact@v4 | |
with: | |
name: combined-assets | |
path: dist-trunk | |
- name: Analyze dependencies and publish report | |
uses: Automattic/github-action-wordpress-dependencies-report@v0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
old-assets-folder: ${{ github.workspace }}/dist-trunk | |
old-assets-branch: trunk | |
new-assets-folder: ${{ github.workspace }}/assets/dist |