Skip to content

Commit 0d74d96

Browse files
Adding GitHub Action to combine schemas
Signed-off-by: Steve Springett <[email protected]>
1 parent fbaf3de commit 0d74d96

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Bundle CycloneDX 2.0 JSON Schemas
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Change to your default branch name if different
7+
paths:
8+
- 'schema/2.0/**/*.schema.json'
9+
- 'tools/src/main/js/bundle-schemas.js'
10+
workflow_dispatch: # Allows manual trigger
11+
12+
jobs:
13+
bundle-schemas:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write # Required to push changes
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
30+
- name: Install dependencies
31+
working-directory: tools/src/main/js
32+
run: npm install
33+
34+
- name: Bundle schemas
35+
working-directory: tools/src/main/js
36+
run: |
37+
node bundle-schemas.js \
38+
../../../../schema/2.0/model \
39+
../../../../schema/2.0/cyclonedx-2.0.schema.json
40+
41+
- name: Check for changes
42+
id: git-check
43+
run: |
44+
git diff --exit-code schema/2.0/cyclonedx-2.0-bundled.schema.json || echo "changed=true" >> $GITHUB_OUTPUT
45+
46+
- name: Commit and push changes
47+
if: steps.git-check.outputs.changed == 'true'
48+
run: |
49+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
50+
git config --local user.name "github-actions[bot]"
51+
git add schema/2.0/cyclonedx-2.0-bundled.schema.json
52+
git commit -m "chore: update bundled schema [skip ci]"
53+
git push

0 commit comments

Comments
 (0)