|
| 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 | + if: github.repository == 'JabRef/jabref' |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Check out repository |
| 20 | + # Full history is preferred so create-pull-request can diff and commit |
| 21 | + uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Set up JDK 24 (Corretto) |
| 26 | + uses: actions/setup-java@v5 |
| 27 | + with: |
| 28 | + distribution: 'corretto' |
| 29 | + java-version: '24' |
| 30 | + check-latest: true |
| 31 | + cache: 'gradle' |
| 32 | + |
| 33 | + - name: Setup Gradle |
| 34 | + uses: gradle/actions/setup-gradle@v4 |
| 35 | + |
| 36 | + - name: Generate aggregated CycloneDX SBOM |
| 37 | + run: ./gradlew --no-daemon cyclonedxBom |
| 38 | + |
| 39 | + - name: Copy SBOMs to repository root |
| 40 | + run: | |
| 41 | + set -euo pipefail |
| 42 | + src_dir="build/reports/cyclonedx" |
| 43 | + if [ ! -f "$src_dir/bom.json" ] || [ ! -f "$src_dir/bom.xml" ]; then |
| 44 | + echo "SBOM files not found in $src_dir" 1>&2 |
| 45 | + ls -la "$src_dir" || true |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | + cp "$src_dir/bom.json" ./bom.json |
| 49 | + cp "$src_dir/bom.xml" ./bom.xml |
| 50 | +
|
| 51 | + - name: Create Pull Request |
| 52 | + uses: peter-evans/create-pull-request@v6 |
| 53 | + with: |
| 54 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + commit-message: "chore(sbom): update CycloneDX SBOM files" |
| 56 | + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
| 57 | + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
| 58 | + title: "[Bot] Update SBOM files" |
| 59 | + body: | |
| 60 | + This automated PR updates the aggregated CycloneDX SBOM files (bom.json and bom.xml) in the repository root. |
| 61 | +
|
| 62 | + Generated via Gradle task `cyclonedxBom` using the org.cyclonedx.bom plugin configured in the build. |
| 63 | + branch: chore/update-sbom |
| 64 | + delete-branch: true |
| 65 | + labels: sbom, dependencies |
| 66 | + add-paths: | |
| 67 | + bom.json |
| 68 | + bom.xml |
0 commit comments