-
Notifications
You must be signed in to change notification settings - Fork 102
61 lines (53 loc) · 1.72 KB
/
search-dev-tools.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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/[email protected]
with:
token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}
- name: Setup Node
uses: actions/[email protected]
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 }}" != "[email protected]" ]; then
git config user.name "WordPress VIP Bot"
git config user.email [email protected]
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 }}