Skip to content

Commit ce84916

Browse files
blackheavenfrasertweedale
authored andcommitted
feature(ci): check only changed advisories
1 parent dff6d9a commit ce84916

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/check-advisories-standalone.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
check-advisories:
3232
name: Invoke check-advisories workflow
3333
needs: [tools_changed, advisories_changed]
34-
if: ${{ needs.tools_changed.outputs.should_skip == 'true' && needs.advisories_changed.outputs.should_skip != 'true' }}
34+
if: ${{ needs.tools_changed.outputs.should_skip == 'true' && needs.advisories_changed.outputs.should_skip != 'true' }}
3535
uses: ./.github/workflows/check-advisories.yml
3636
with:
3737
artifact-name: hsec-tools-main
38+
changed-advisories: ${{ toJSON(needs.advisories_changed.outputs.changed_files) }}

.github/workflows/check-advisories.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
artifact-name:
66
required: true
77
type: string
8+
changed-advisoriese:
9+
required: false
10+
type: string
11+
default: '[]'
812
jobs:
913
check-advisories:
1014
runs-on: ubuntu-20.04
@@ -23,6 +27,8 @@ jobs:
2327
path: ~/.local/bin
2428
- run: chmod +x ~/.local/bin/hsec-tools
2529
- name: Run advisory syntax checks
30+
env:
31+
CHANGED_ADVISORIES: ${{ fromJSON(inputs.changed-advisories) }}
2632
run: |
2733
cd source
2834
RESULT=0
@@ -31,7 +37,7 @@ jobs:
3137
while read FILE ; do
3238
echo -n "$FILE: "
3339
hsec-tools check "$FILE" || RESULT=1
34-
done < <(find advisories EXAMPLE_README.md EXAMPLE_ADVISORY.md -type f -name "*.md")
40+
done < <([ ${#CHANGED_ADVISORIES[@]} -gt 0 ] && echo $CHANGED_ADVISORIES || find advisories EXAMPLE_README.md EXAMPLE_ADVISORY.md -type f -name "*.md")
3541
exit $RESULT
3642
- name: Run advisory uniqueness checks
3743
run: |

0 commit comments

Comments
 (0)