Skip to content

Commit 14c8e6d

Browse files
committed
chore: output inside audit script
1 parent 4c1e50f commit 14c8e6d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/audit-dependencies.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ audit_length=$(jq 'length' $output_file)
2121

2222
if [[ "${audit_length}" -gt "0" ]]; then
2323
echo "Actionable vulnerabilities found in the following packages:"
24-
jq -r '.[] | "\u001b[1m\(.package)\u001b[0m vulnerable in \u001b[31m\(.vulnerable)\u001b[0m fixed in \u001b[32m\(.fixed_in)\u001b[0m"' $output_file | while read -r line; do echo -e "$line"; done
24+
audit_output=$(jq -r '.[] | "\u001b[1m\(.package)\u001b[0m vulnerable in \u001b[31m\(.vulnerable)\u001b[0m fixed in \u001b[32m\(.fixed_in)\u001b[0m"' $output_file | while read -r line; do echo -e "$line"; done)
2525
echo "Output written to ${output_file}"
26+
echo "{audit_output}={$audit_output}" >>$GITHUB_OUTPUT
2627
exit 1
2728
else
2829
echo "No actionable vulnerabilities"

.github/workflows/audit-dependencies.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ jobs:
3434
run: ./.github/workflows/audit-dependencies.sh ${{ inputs.audit-level }}
3535

3636
- name: Failure output
37-
id: failure_output
3837
if: failure()
3938
run: |
4039
echo "Vulnerabilities found."
4140
cat audit_output.json
42-
# Output json content to GitHub Actions output
43-
echo "audit_output=$(cat audit_output.json)" >> $GITHUB_OUTPUT
41+
# echo audit_dependencies.outputs.audit_output
42+
echo ${{ steps.audit_dependencies.outputs.audit_output }}
4443
4544
- name: Slack notification on failure
4645
if: failure()
@@ -54,7 +53,7 @@ jobs:
5453
- type: "section"
5554
text:
5655
type: "mrkdwn"
57-
text: "Actionable vulnerabilities found: ${{ steps.failure_output.outputs.audit_output }}"
56+
text: "Actionable vulnerabilities found: ${{ steps.audit_dependencies.outputs.audit_output }}"
5857
- type: "section"
5958
text:
6059
type: "mrkdwn"

0 commit comments

Comments
 (0)