Skip to content

Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev-threatmode… #36

Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev-threatmode…

Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev-threatmode… #36

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
jobs:
bundle-schemas:
runs-on: ubuntu-latest
permissions:
contents: write # Required to push changes
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
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