Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: update automated PR creation for outdated dependencies #210

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -34,11 +36,35 @@ jobs:
docker run --rm -v ${{ github.workspace }}:/src aquasec/trivy:latest fs /src \
--scanners secret \
--format table > trivy-secret-report.txt

# custom check
- name: Check for outdated npm packages
run: |
npm outdated > npm-outdated-report.txt || echo "Some packages may be outdated."

- name: Automatically update outdated npm packages
run: |
npm update

- name: Commit and Push Changes if Packages Are Updated
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add .
git commit -m "chore: update outdated npm packages" || echo "No changes to commit"
git push origin HEAD || echo "No changes to push"

- name: Create Pull Request for Dependency Updates
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "dependency-updates"
base: ${{ github.base_ref }}
title: "chore: update outdated npm packages"
body: |
This PR updates the following npm packages to their latest versions.
- Automatically generated by the CI.
labels: "dependencies, automated"

- name: Handling empty files
run: |
Expand Down Expand Up @@ -93,4 +119,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: trivy scan (vs and ss)
path: trivy-V-and-S-Scan-report.md
path: trivy-V-and-S-Scan-report.md
Loading