Skip to content

Commit

Permalink
chore: Updated ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Jul 22, 2024
1 parent f365d7a commit 2c00f3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/composer-dependency-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,27 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Check for outdated dependencies
run: composer outdated --direct --format=json > outdated.json
run: composer outdated --direct --format=json > outdated.json || echo "{}" > outdated.json

- name: Security Check
uses: symfonycorp/security-checker-action@v5
id: security-check
continue-on-error: true

- name: Process and Output Dependency Health Results
if: always()
run: |
echo "# Composer Dependency Health Report" >> $GITHUB_STEP_SUMMARY
echo "## Outdated Packages:" >> $GITHUB_STEP_SUMMARY
if [ -s outdated.json ]; then
if [ -s outdated.json ] && [ "$(cat outdated.json)" != "{}" ]; then
jq -r '.installed[] | "- \(.name) (\(.version) => \(.latest))"' outdated.json >> $GITHUB_STEP_SUMMARY
else
echo "No outdated packages found." >> $GITHUB_STEP_SUMMARY
fi
echo "## Security Vulnerabilities:" >> $GITHUB_STEP_SUMMARY
if [ -s ${{ steps.security-check.outputs.logfile }} ]; then
if [ -f "${{ steps.security-check.outputs.logfile }}" ] && [ -s "${{ steps.security-check.outputs.logfile }}" ]; then
cat ${{ steps.security-check.outputs.logfile }} >> $GITHUB_STEP_SUMMARY
else
echo "No security vulnerabilities detected." >> $GITHUB_STEP_SUMMARY
Expand All @@ -58,8 +59,8 @@ jobs:
- name: Check for Critical Issues
if: always()
run: |
VULNERABILITIES=$(cat ${{ steps.security-check.outputs.logfile }} | wc -l)
VULNERABILITIES=$([ -f "${{ steps.security-check.outputs.logfile }}" ] && cat "${{ steps.security-check.outputs.logfile }}" | wc -l || echo "0")
OUTDATED=$(jq '.installed | length' outdated.json)
if [ $VULNERABILITIES -gt 0 ] || [ $OUTDATED -gt 0 ]; then
if [ "$VULNERABILITIES" != "0" ] || [ "$OUTDATED" != "0" ]; then
echo "::warning::Dependency issues detected. Please check the workflow summary for details."
fi
6 changes: 3 additions & 3 deletions .github/workflows/npm-dependency-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
run: npm ci

- name: Check for outdated dependencies
run: npm outdated --json > outdated.json
run: npm outdated --json > outdated.json || echo "{}" > outdated.json

- name: Run security audit
run: npm audit --json > audit.json
run: npm audit --json > audit.json || echo "{}" > audit.json

- name: Process and Output Dependency Health Results
if: always()
Expand Down Expand Up @@ -63,6 +63,6 @@ jobs:
run: |
VULNERABILITIES=$(jq '.vulnerabilities | length' audit.json)
OUTDATED=$(jq 'length' outdated.json)
if [ $VULNERABILITIES -gt 0 ] || [ $OUTDATED -gt 0 ]; then
if [ "$VULNERABILITIES" != "0" ] || [ "$OUTDATED" != "0" ]; then
echo "::warning::Dependency issues detected. Please check the workflow summary for details."
fi

0 comments on commit 2c00f3a

Please sign in to comment.