@@ -2,10 +2,13 @@ name: Check and publish security advisories
2
2
on :
3
3
workflow_call :
4
4
inputs :
5
- artifact-name :
5
+ fetch-key :
6
6
required : true
7
7
type : string
8
- changed-advisoriese :
8
+ is-artifact :
9
+ required : true
10
+ type : boolean
11
+ changed-advisories :
9
12
required : false
10
13
type : string
11
14
default : ' []'
@@ -19,24 +22,33 @@ jobs:
19
22
# We need to retrieve full history to determine the correct
20
23
# `published` and `modified` timestamps
21
24
fetch-depth : 0
22
- - run : mkdir -p ~/.local/bin
23
- - id : download
25
+ - run : mkdir -p ~/.local/dockerImages
26
+ - name : Fetch artifact
27
+ if : ${{ inputs.is-artifact }}
24
28
uses : actions/download-artifact@v3
25
29
with :
26
- name : ${{ inputs.artifact-name }}
27
- path : ~/.local/bin
28
- - run : chmod +x ~/.local/bin/hsec-tools
30
+ name : ${{ inputs.fetch-key }}
31
+ path : ~/.local/dockerImages
32
+ - name : Fetch cache
33
+ if : ${{ !inputs.is-artifact }}
34
+ uses : actions/cache/restore@v3
35
+ with :
36
+ key : ${{ inputs.fetch-key }}
37
+ path : ~/.local/dockerImages
38
+ fail-on-cache-miss : true
39
+ - run : docker load -i ~/.local/dockerImages/hsec-tools
40
+ - name : ' Setup jq'
41
+
29
42
- name : Run advisory syntax checks
30
- env :
31
- CHANGED_ADVISORIES : ${{ fromJSON(inputs.changed-advisories) }}
32
43
run : |
44
+ CHANGED_ADVISORIES=( $(echo "${{ inputs.changed-advisories }}" | jq -r '.[]') )
33
45
cd source
34
46
RESULT=0
35
47
# Remove the begining of the README to extract the example.
36
48
(echo '```toml'; sed -e '1,/```toml/d' README.md) > EXAMPLE_README.md
37
49
while read FILE ; do
38
50
echo -n "$FILE: "
39
- hsec-tools check "$FILE" || RESULT=1
51
+ docker run --rm -v $PWD:/advisories haskell/ hsec-tools:latest /bin/hsec-tools check "advisories/ $FILE" || RESULT=1
40
52
done < <([ ${#CHANGED_ADVISORIES[@]} -gt 0 ] && echo $CHANGED_ADVISORIES || find advisories EXAMPLE_README.md EXAMPLE_ADVISORY.md -type f -name "*.md")
41
53
exit $RESULT
42
54
- name : Run advisory uniqueness checks
0 commit comments