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

Fixed the Failed workflows for checking the outdated packages #216

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: write

jobs:
trivy_scan:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,6 +43,34 @@ jobs:
run: |
npm outdated > npm-outdated-report.txt || echo "Some packages may be outdated."

- name: Updates the outdated dependencies
run:
npx npm-check-updates -u
npm update

- name: Commit changes push them
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add package.json package-lock.json
git commit -m "chore: update outdated npm packages"
git push origin HEAD || echo "No changes to push"

- name: Create Pull Request for updated Dependenncies
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-dependencies-branch
base: ${{ github.base_ref }}
title: "chore: update outdated npm dependencies"
body: |
This PR updates the following outdated npm dependencies:
- Updated dependencies using npm-check-updates
- Automatically created by GitHub Actions
commit-message: "chore: update outdated npm dependencies"
labels: "dependencies, automated update"
assignees: "your-github-username" # Optional: assign the PR to someone

- name: Handling empty files
run: |
is_empty(){
Expand Down
Loading