-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add node and npm upgrade workflows as well as a dependency check summary workflow and updated doc proposal #4023
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
Open
salmanmkc
wants to merge
30
commits into
actions:main
Choose a base branch
from
salmanmkc:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9b3d0e5
Add GitHub Actions workflow for NPM audit fixes
salmanmkc 82dfec2
node-upgrade script
salmanmkc ba6105a
rename files
salmanmkc 53ab704
Add automated workflows for dependency management and update document…
salmanmkc cea2d6a
Skip husky checks
salmanmkc d8bc6ca
Update Node.js version numbers in externals.sh
salmanmkc d9ab6d9
Add workflows for automated npm audit fixes and TypeScript compatibil…
salmanmkc d22a8e7
Merge branch 'main' of https://github.com/salmanmkc/runner
salmanmkc b0cab2e
Format the PR descriptions
salmanmkc 1e5bf22
Fix npm audit output handling and ensure vulnerability count is numeric
salmanmkc 28d477c
bump verisons back
salmanmkc 6020b37
Remove broken workflow file
salmanmkc 60062af
Update for silent failures
salmanmkc 7926eda
Improve npm audit handling and output reporting
salmanmkc 3f773c2
lower versions for testing
salmanmkc e015312
test: downgrade packages to vulnerable versions for testing npm audit…
salmanmkc 50ae198
test: add axios vulnerable version for npm audit testing
salmanmkc ed5a65f
test: simplify to just axios vuln and old @types/node for testing
salmanmkc 493779b
test: update @types/node to version 20.6.2 for compatibility
salmanmkc b3ecf4b
revert: remove axios dependency from package.json
salmanmkc 53d153b
chore: remove NPM Audit Fix workflow from GitHub Actions
salmanmkc 8539126
Update externals.sh
salmanmkc 18d4e96
Update npm-audit-ts-fix.yml
salmanmkc 5887c9e
Update npm-audit-ts-fix.yml
salmanmkc 1424843
Update npm-audit-ts-fix.yml
salmanmkc a89271b
Update npm-audit-ts-fix.yml
salmanmkc 5d6ba21
Change runner from ubuntu-latest to path-test
salmanmkc e59a88f
Merge pull request #15 from salmanmkc/salmanmkc-patch-1
salmanmkc 6b3806a
Change runner from path-test to path-test-2
salmanmkc 8149c53
Merge pull request #16 from salmanmkc/salmanmkc-patch-2
salmanmkc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| name: Dependency Status Check | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| check_type: | ||
| description: "Type of dependency check" | ||
| required: false | ||
| default: "all" | ||
| type: choice | ||
| options: | ||
| - all | ||
| - node | ||
| - dotnet | ||
| - docker | ||
| - npm | ||
| schedule: | ||
| - cron: "0 8 * * 1" # Weekly on Monday at 8 AM | ||
|
|
||
| jobs: | ||
| dependency-status: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| node20-status: ${{ steps.check-versions.outputs.node20-status }} | ||
| node24-status: ${{ steps.check-versions.outputs.node24-status }} | ||
| dotnet-status: ${{ steps.check-versions.outputs.dotnet-status }} | ||
| docker-status: ${{ steps.check-versions.outputs.docker-status }} | ||
| buildx-status: ${{ steps.check-versions.outputs.buildx-status }} | ||
| npm-vulnerabilities: ${{ steps.check-versions.outputs.npm-vulnerabilities }} | ||
| open-dependency-prs: ${{ steps.check-prs.outputs.open-dependency-prs }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Check dependency versions | ||
| id: check-versions | ||
| run: | | ||
| echo "## Dependency Status Report" >> $GITHUB_STEP_SUMMARY | ||
| echo "Generated on: $(date)" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| # Check Node versions | ||
| if [[ "${{ github.event.inputs.check_type }}" == "all" || "${{ github.event.inputs.check_type }}" == "node" ]]; then | ||
| echo "### Node.js Versions" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| VERSIONS_JSON=$(curl -s https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json) | ||
| LATEST_NODE20=$(echo "$VERSIONS_JSON" | jq -r '.[] | select(.version | startswith("20.")) | .version' | head -1) | ||
| LATEST_NODE24=$(echo "$VERSIONS_JSON" | jq -r '.[] | select(.version | startswith("24.")) | .version' | head -1) | ||
|
|
||
| CURRENT_NODE20=$(grep "NODE20_VERSION=" src/Misc/externals.sh | cut -d'"' -f2) | ||
| CURRENT_NODE24=$(grep "NODE24_VERSION=" src/Misc/externals.sh | cut -d'"' -f2) | ||
|
|
||
| NODE20_STATUS="✅ up-to-date" | ||
| NODE24_STATUS="✅ up-to-date" | ||
|
|
||
| if [ "$CURRENT_NODE20" != "$LATEST_NODE20" ]; then | ||
| NODE20_STATUS="⚠️ outdated" | ||
| fi | ||
|
|
||
| if [ "$CURRENT_NODE24" != "$LATEST_NODE24" ]; then | ||
| NODE24_STATUS="⚠️ outdated" | ||
| fi | ||
|
|
||
| echo "| Version | Current | Latest | Status |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|---------|---------|--------|--------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Node 20 | $CURRENT_NODE20 | $LATEST_NODE20 | $NODE20_STATUS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Node 24 | $CURRENT_NODE24 | $LATEST_NODE24 | $NODE24_STATUS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| echo "node20-status=$NODE20_STATUS" >> $GITHUB_OUTPUT | ||
| echo "node24-status=$NODE24_STATUS" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| # Check .NET version | ||
| if [[ "${{ github.event.inputs.check_type }}" == "all" || "${{ github.event.inputs.check_type }}" == "dotnet" ]]; then | ||
| echo "### .NET SDK Version" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| current_dotnet_version=$(jq -r .sdk.version ./src/global.json) | ||
| current_major_minor=$(echo "$current_dotnet_version" | cut -d '.' -f 1,2) | ||
| latest_dotnet_version=$(curl -sb -H "Accept: application/json" "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$current_major_minor/latest.version") | ||
|
|
||
| DOTNET_STATUS="✅ up-to-date" | ||
| if [ "$current_dotnet_version" != "$latest_dotnet_version" ]; then | ||
| DOTNET_STATUS="⚠️ outdated" | ||
| fi | ||
|
|
||
| echo "| Component | Current | Latest | Status |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|-----------|---------|--------|--------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| .NET SDK | $current_dotnet_version | $latest_dotnet_version | $DOTNET_STATUS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| echo "dotnet-status=$DOTNET_STATUS" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| # Check Docker versions | ||
| if [[ "${{ github.event.inputs.check_type }}" == "all" || "${{ github.event.inputs.check_type }}" == "docker" ]]; then | ||
| echo "### Docker Versions" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| current_docker=$(grep "ARG DOCKER_VERSION=" ./images/Dockerfile | cut -d'=' -f2) | ||
| current_buildx=$(grep "ARG BUILDX_VERSION=" ./images/Dockerfile | cut -d'=' -f2) | ||
|
|
||
| latest_docker=$(curl -s https://download.docker.com/linux/static/stable/x86_64/ | grep -o 'docker-[0-9]*\.[0-9]*\.[0-9]*\.tgz' | sort -V | tail -n 1 | sed 's/docker-\(.*\)\.tgz/\1/') | ||
| latest_buildx=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | jq -r '.tag_name' | sed 's/^v//') | ||
|
|
||
| DOCKER_STATUS="✅ up-to-date" | ||
| BUILDX_STATUS="✅ up-to-date" | ||
|
|
||
| if [ "$current_docker" != "$latest_docker" ]; then | ||
| DOCKER_STATUS="⚠️ outdated" | ||
| fi | ||
|
|
||
| if [ "$current_buildx" != "$latest_buildx" ]; then | ||
| BUILDX_STATUS="⚠️ outdated" | ||
| fi | ||
|
|
||
| echo "| Component | Current | Latest | Status |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|-----------|---------|--------|--------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Docker | $current_docker | $latest_docker | $DOCKER_STATUS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Docker Buildx | $current_buildx | $latest_buildx | $BUILDX_STATUS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| echo "docker-status=$DOCKER_STATUS" >> $GITHUB_OUTPUT | ||
| echo "buildx-status=$BUILDX_STATUS" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| # Check npm vulnerabilities | ||
| if [[ "${{ github.event.inputs.check_type }}" == "all" || "${{ github.event.inputs.check_type }}" == "npm" ]]; then | ||
| echo "### NPM Security Audit" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| cd src/Misc/expressionFunc/hashFiles | ||
| npm install --silent | ||
| AUDIT_OUTPUT=$(npm audit --json 2>/dev/null || echo '{"metadata":{"vulnerabilities":{"total":0}}}') | ||
| VULN_COUNT=$(echo "$AUDIT_OUTPUT" | jq '.metadata.vulnerabilities.total // 0') | ||
|
|
||
| # Ensure VULN_COUNT is a number | ||
| VULN_COUNT=$(echo "$VULN_COUNT" | grep -o '[0-9]*' | head -1) | ||
| VULN_COUNT=${VULN_COUNT:-0} | ||
|
|
||
| NPM_STATUS="✅ no vulnerabilities" | ||
| if [ "$VULN_COUNT" -gt 0 ] 2>/dev/null; then | ||
| NPM_STATUS="⚠️ $VULN_COUNT vulnerabilities found" | ||
|
|
||
| # Get vulnerability details | ||
| HIGH_VULNS=$(echo "$AUDIT_OUTPUT" | jq '.metadata.vulnerabilities.high // 0') | ||
| CRITICAL_VULNS=$(echo "$AUDIT_OUTPUT" | jq '.metadata.vulnerabilities.critical // 0') | ||
|
|
||
| echo "| Severity | Count |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Critical | $CRITICAL_VULNS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| High | $HIGH_VULNS |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "No npm vulnerabilities found ✅" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
|
|
||
| echo "npm-vulnerabilities=$NPM_STATUS" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Check for open dependency PRs | ||
| id: check-prs | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| echo "### Open Dependency PRs" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| # Get open PRs with dependency label | ||
| OPEN_PRS=$(gh pr list --label "dependency" --state open --json number,title,url) | ||
| PR_COUNT=$(echo "$OPEN_PRS" | jq '. | length') | ||
|
|
||
| if [ "$PR_COUNT" -gt 0 ]; then | ||
| echo "Found $PR_COUNT open dependency PR(s):" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "$OPEN_PRS" | jq -r '.[] | "- [#\(.number)](\(.url)) \(.title)"' >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "No open dependency PRs found ✅" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
|
|
||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "open-dependency-prs=$PR_COUNT" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Summary | ||
| run: | | ||
| echo "### Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Check for open PRs with the \`dependency\` label before releases" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Review and merge dependency updates regularly" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Critical vulnerabilities should be addressed immediately" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**Automated workflows run weekly to check for updates:**" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Node.js versions (Mondays at 6 AM)" >> $GITHUB_STEP_SUMMARY | ||
| echo "- NPM audit fix (Mondays at 7 AM)" >> $GITHUB_STEP_SUMMARY | ||
| echo "- .NET SDK updates (Mondays at midnight)" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Docker/Buildx updates (Mondays at midnight)" >> $GITHUB_STEP_SUMMARY | ||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.