-
-
Notifications
You must be signed in to change notification settings - Fork 91
62 lines (52 loc) · 1.94 KB
/
Copy pathbundle_2.0_schemas.yml
File metadata and controls
62 lines (52 loc) · 1.94 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
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/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
# see https://github.com/actions/checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
# see https://github.com/actions/setup-node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
- name: Install dependencies
working-directory: tools/src/main/js
run: npm install
- name: Bundle schemas
working-directory: tools/src/main/js
run: |
node bundle-schemas.js \
../../../../schema/2.0/model \
../../../../schema/2.0/cyclonedx-2.0.schema.json
- name: Check for changes and commit
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BUNDLED_FILE="schema/2.0/cyclonedx-2.0-bundled.schema.json"
# Add the file (works for both new and modified files)
git add "$BUNDLED_FILE"
# Check if there are staged changes
if git diff --staged --quiet; then
echo "No changes to bundled schema"
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 schema [skip ci]"
git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
fi