|
| 1 | +name: Update SBOM and open PR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + generate-and-pr: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Check out repository |
| 19 | + uses: actions/checkout@v5 |
| 20 | + |
| 21 | + - name: Set up JDK |
| 22 | + uses: actions/setup-java@v5 |
| 23 | + with: |
| 24 | + distribution: 'corretto' |
| 25 | + java-version: '24' |
| 26 | + check-latest: true |
| 27 | + cache: 'gradle' |
| 28 | + |
| 29 | + - name: Setup Gradle |
| 30 | + uses: gradle/actions/setup-gradle@v4 |
| 31 | + |
| 32 | + - name: Generate aggregated CycloneDX SBOM |
| 33 | + run: ./gradlew cyclonedxBom |
| 34 | + |
| 35 | + - name: Copy SBOMs to repository root |
| 36 | + run: | |
| 37 | + set -euo pipefail |
| 38 | + src_dir="build/reports/cyclonedx" |
| 39 | + if [ ! -f "$src_dir/bom.json" ] || [ ! -f "$src_dir/bom.xml" ]; then |
| 40 | + echo "SBOM files not found in $src_dir" 1>&2 |
| 41 | + ls -la "$src_dir" || true |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | + cp "$src_dir/bom.json" bom.json |
| 45 | + cp "$src_dir/bom.xml" bom.xml |
| 46 | + echo "" >> bom.xml |
| 47 | + echo "" >> bom.json |
| 48 | +
|
| 49 | + - name: Create Pull Request |
| 50 | + uses: peter-evans/create-pull-request@v7 |
| 51 | + with: |
| 52 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + commit-message: "chore(sbom): update CycloneDX SBOM files" |
| 54 | + title: "[Bot] Update SBOM files" |
| 55 | + body: | |
| 56 | + This automated PR updates the aggregated CycloneDX SBOM files (bom.json and bom.xml) in the repository root. |
| 57 | +
|
| 58 | + Generated via Gradle task `cyclonedxBom` using the org.cyclonedx.bom plugin configured in the build. |
| 59 | + branch: chore/update-sbom |
| 60 | + delete-branch: true |
| 61 | + labels: "dev: dependencies"" |
| 62 | + add-paths: | |
| 63 | + bom.json |
| 64 | + bom.xml |
0 commit comments