-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-actions-policy-consumer.yml
More file actions
67 lines (56 loc) · 1.81 KB
/
Copy pathgithub-actions-policy-consumer.yml
File metadata and controls
67 lines (56 loc) · 1.81 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
63
64
65
66
67
# Example only. Copy this file into a consumer repository under
# .github/workflows/ if useful. This repository does not run this file as a
# workflow.
name: Dependency policy review
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
dependency-policy:
runs-on: ubuntu-latest
steps:
- name: Check out consumer repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Download sbom-diff-and-risk release wheel
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p .tooling/sbom-diff-risk
gh release download v1.0.0 \
--repo stacknil/scientific-computing-toolkit \
--pattern "sbom_diff_and_risk-1.0.0-py3-none-any.whl" \
--dir .tooling/sbom-diff-risk
- name: Install sbom-diff-risk
run: |
python -m pip install \
.tooling/sbom-diff-risk/sbom_diff_and_risk-1.0.0-py3-none-any.whl
- name: Run dependency policy
id: compare
shell: bash
run: |
mkdir -p outputs
set +e
sbom-diff-risk compare \
--before path/to/before-sbom.json \
--after path/to/after-sbom.json \
--format auto \
--policy path/to/policy.yml \
--policy-json outputs/policy.json
status=$?
set -e
echo "exit_code=$status" >> "$GITHUB_OUTPUT"
- name: Upload policy JSON
if: always()
uses: actions/upload-artifact@v7
with:
name: dependency-policy-json
path: outputs/policy.json
if-no-files-found: error
- name: Pass or fail based on local policy
run: exit "${{ steps.compare.outputs.exit_code }}"