Skip to content

Commit 25fc407

Browse files
fix: pass reusable workflow input from event
1 parent fcb1285 commit 25fc407

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

.github/scripts/test-cve-remediation.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
FILTER="$SCRIPT_DIR/filter-unlinked-cve-issues.jq"
66
DISCOVERY_SCRIPT="$SCRIPT_DIR/find-unlinked-cve-issues.sh"
77
WORKFLOW_FILE="$SCRIPT_DIR/../workflows/_cve-remediation.yml"
8+
CALLER_WORKFLOW_FILE="$SCRIPT_DIR/../workflows/cve-remediation.yml"
89

910
assert_json() {
1011
local description="$1"
@@ -22,8 +23,9 @@ assert_json() {
2223
assert_workflow_contains() {
2324
local description="$1"
2425
local expected="$2"
26+
local workflow_file="${3:-$WORKFLOW_FILE}"
2527

26-
if ! grep -Fq -- "$expected" "$WORKFLOW_FILE"; then
28+
if ! grep -Fq -- "$expected" "$workflow_file"; then
2729
echo "FAIL: $description"
2830
echo "Expected workflow to contain: $expected"
2931
exit 1
@@ -33,8 +35,9 @@ assert_workflow_contains() {
3335
assert_workflow_not_contains() {
3436
local description="$1"
3537
local unexpected="$2"
38+
local workflow_file="${3:-$WORKFLOW_FILE}"
3639

37-
if grep -Fq -- "$unexpected" "$WORKFLOW_FILE"; then
40+
if grep -Fq -- "$unexpected" "$workflow_file"; then
3841
echo "FAIL: $description"
3942
echo "Expected workflow not to contain: $unexpected"
4043
exit 1
@@ -276,5 +279,13 @@ assert_workflow_not_contains \
276279
assert_workflow_not_contains \
277280
"does not use unavailable job workflow SHA context" \
278281
'job.workflow_sha'
282+
assert_workflow_contains \
283+
"passes a numeric manual or scheduled issue limit through an allowed context" \
284+
"fromJSON(github.event.inputs.max_issues || '50')" \
285+
"$CALLER_WORKFLOW_FILE"
286+
assert_workflow_not_contains \
287+
"does not use the unavailable inputs context in a reusable workflow call" \
288+
'${{ inputs.max_issues' \
289+
"$CALLER_WORKFLOW_FILE"
279290

280291
echo "All CVE remediation tests passed."

.github/workflows/cve-remediation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ jobs:
2626
remediate:
2727
uses: ./.github/workflows/_cve-remediation.yml
2828
with:
29-
max_issues: ${{ inputs.max_issues || 50 }}
29+
max_issues: ${{ fromJSON(github.event.inputs.max_issues || '50') }}
3030
secrets: inherit

0 commit comments

Comments
 (0)