Skip to content

Commit 9dc41b2

Browse files
authored
Merge pull request #80 from casework/add_weeknightly_supply_chain_check
Add weeknightly supply chain check
2 parents e655d83 + c44e92a commit 9dc41b2

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

.github/workflows/supply-chain.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Portions of this file contributed by NIST are governed by the
2+
# following statement:
3+
#
4+
# This software was developed at the National Institute of Standards
5+
# and Technology by employees of the Federal Government in the course
6+
# of their official duties. Pursuant to Title 17 Section 105 of the
7+
# United States Code, this software is not subject to copyright
8+
# protection within the United States. NIST assumes no responsibility
9+
# whatsoever for its use by other parties, and makes no guarantees,
10+
# expressed or implied, about its quality, reliability, or any other
11+
# characteristic.
12+
#
13+
# We would appreciate acknowledgement if the software is used.
14+
15+
# This workflow uses Make to review direct dependencies of this
16+
# repository.
17+
18+
name: Supply Chain
19+
20+
on:
21+
schedule:
22+
- cron: '15 5 * * 1,2,3,4,5'
23+
24+
jobs:
25+
build:
26+
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
python-version:
31+
- '3.9'
32+
- '3.13'
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
# This enables supply chain review against only a selected
38+
# branch. For those using the "Git-Flow" style of branching,
39+
# the ref value should be 'develop', so an upstream dependency
40+
# only relevant for, say, code formatting does not need to
41+
# induce a new commit on 'main', or a release.
42+
# https://cyberdomainontology.org/ontology/development/#branching-cdo-git-flow
43+
ref: main
44+
- name: Set up Python ${{ matrix.python-version }}
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
- name: Review dependencies
49+
run: make check-supply-chain

Makefile

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ all: \
3535
case.jsonld
3636

3737
.PHONY: \
38-
check-mypy
38+
check-mypy \
39+
check-supply-chain \
40+
check-supply-chain-pre-commit
3941

4042
# This virtual environment is meant to be built once and then persist, even through 'make clean'.
4143
# If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
@@ -118,3 +120,38 @@ check-mypy: \
118120
case_mapping \
119121
example.py \
120122
tests
123+
124+
check-supply-chain: \
125+
check-supply-chain-pre-commit \
126+
check-mypy
127+
128+
# Update pre-commit configuration and use the updated config file to
129+
# review code. Only have Make exit if 'pre-commit run' modifies files.
130+
check-supply-chain-pre-commit: \
131+
.venv-pre-commit/var/.pre-commit-built.log
132+
source .venv-pre-commit/bin/activate \
133+
&& pre-commit autoupdate
134+
git diff \
135+
--exit-code \
136+
.pre-commit-config.yaml \
137+
|| ( \
138+
source .venv-pre-commit/bin/activate \
139+
&& pre-commit run \
140+
--all-files \
141+
--config .pre-commit-config.yaml \
142+
) \
143+
|| git diff \
144+
--stat \
145+
--exit-code \
146+
|| ( \
147+
echo \
148+
"WARNING:Makefile:pre-commit configuration can be updated. It appears the updated would change file formatting." \
149+
>&2 \
150+
; exit 1 \
151+
)
152+
@git diff \
153+
--exit-code \
154+
.pre-commit-config.yaml \
155+
|| echo \
156+
"INFO:Makefile:pre-commit configuration can be updated. It appears the update would not change file formatting." \
157+
>&2

0 commit comments

Comments
 (0)