-
-
Notifications
You must be signed in to change notification settings - Fork 84
60 lines (49 loc) · 1.84 KB
/
bundle_2.0_schemas.yml
File metadata and controls
60 lines (49 loc) · 1.84 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
name: Bundle CycloneDX 2.0 JSON Schemas
on:
push:
branches:
- 2.0-dev
- 2.0-dev-threatmodeling
paths:
- 'schema/2.0/**/*.schema.json'
- 'tools/src/main/js/bundler/bundle-schemas.js'
workflow_dispatch: # Allows manual trigger
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions: {}
jobs:
bundle-schemas:
runs-on: ubuntu-latest
permissions:
contents: write # Required to push changes
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
working-directory: tools/src/main/js/bundler
run: npm install
- name: Bundle schemas
working-directory: tools/src/main/js/bundler
run: |
node bundle-schemas.js \
../../../../../schema/2.0/model \
../../../../../schema/2.0/cyclonedx-2.0.schema.json
- name: Check for changes and commit
run: |
BUNDLED_FILE="schema/2.0/cyclonedx-2.0-bundled.schema.json"
MINIFIED_FILE="schema/2.0/cyclonedx-2.0-bundled.min.schema.json"
# Add both files (works for both new and modified files)
git add "$BUNDLED_FILE" "$MINIFIED_FILE"
# Check if there are staged changes
if git diff --staged --quiet; then
echo "No changes to bundled schemas"
else
echo "Committing bundled schema changes"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "chore: update bundled schemas [skip ci]"
git push
fi