Skip to content

Merge pull request #5581 from Automattic/develop #1754

Merge pull request #5581 from Automattic/develop

Merge pull request #5581 from Automattic/develop #1754

name: Search Dev Tools
on:
push:
paths:
- 'search/search-dev-tools/**'
- '.github/workflows/search-dev-tools.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
search-dev-tools:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out source code
uses: actions/checkout@v4.1.5
with:
token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v4.0.2
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: search/search-dev-tools/package-lock.json
- name: Install dependencies
run: npm ci --ignore-scripts
working-directory: search/search-dev-tools
- name: Build files
run: npm run build
working-directory: search/search-dev-tools
- name: Check the diff
run: |
if [ "$(git diff --ignore-space-at-eol search/search-dev-tools/ | wc -l)" -gt "0" ]; then
echo "::warning::There are changes in the built files."
if [ "${{ github.event.head_commit.committer.email }}" != "no-reply@automattic.com" ]; then
git config user.name "WordPress VIP Bot"
git config user.email no-reply@automattic.com
git config push.default "current"
git add search/search-dev-tools/
git commit -m "Regenerate the bundle"
git push
else
echo "::error::Aborting to avoid the loop."
exit 1
fi
fi
env:
GH_TOKEN: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}