-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (61 loc) · 2.3 KB
/
rebuild.yml
File metadata and controls
63 lines (61 loc) · 2.3 KB
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
62
63
name: Rebuild sample UI
on:
schedule:
- cron: 0 0 * * 2
workflow_dispatch:
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Rebuild
if: github.repository == 'CrowdStrike/foundry-sample-functions-python'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 22
- name: Check if rebuild needed
id: check
run: |
LAST_BUILD=$(git log -1 --format=%H -- ui/extensions/hello/src/dist/)
if [ -z "$LAST_BUILD" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "No previous build found, rebuilding"
exit 0
fi
CHANGES=$(git diff --name-only "$LAST_BUILD" HEAD -- ui/extensions/hello/package.json ui/extensions/hello/package-lock.json)
if [ -z "$CHANGES" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "No dependency changes since last build, skipping"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "Dependency changes detected:"
echo "$CHANGES"
fi
- name: Install dependencies
if: steps.check.outputs.skip != 'true'
run: npm ci
working-directory: ui/extensions/hello
- name: Build React app
if: steps.check.outputs.skip != 'true'
run: npm run build
working-directory: ui/extensions/hello
- name: Create commit
if: steps.check.outputs.skip != 'true'
run: |
git add .
git commit -a -m "Rebuild UI with latest dependencies" || true
- name: Create Pull Request
if: steps.check.outputs.skip != 'true'
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Rebuild with latest dependencies'
title: 'Rebuild with latest dependencies'
body: Weekly build with latest dependencies.
labels: 'dependencies'