Skip to content

Conversation

@salmanmkc
Copy link
Contributor

Overview

This PR adds automated Node.js version management to keep the runner current with the latest LTS versions.

What's Added

🔄 Node.js Version Upgrade Workflow (.github/workflows/node-upgrade.yml)

  • Automated version checking for Node 20.x and 24.x LTS releases
  • Smart updates to NODE20_VERSION and NODE24_VERSION in src/Misc/externals.sh
  • Weekly schedule (Mondays at 6 AM) plus manual triggers
  • PR creation only when newer versions are available

Key Features

  • Dual Node version support (Node 20 LTS + Node 24 LTS)
  • Official version source (actions/node-versions manifest)
  • Smart change detection (only creates PR if versions differ)
  • Proper automation (git operations with --no-verify)
  • Alpine reminder (manual alpine_nodejs release follow-up)

Dependencies

Testing

  • ✅ Tested version detection logic
  • ✅ Verified externals.sh update mechanism
  • ✅ Confirmed PR creation with proper formatting

Next Steps

  • This workflow handles Node.js runtime versions
  • Separate PR will handle npm security management (npm-audit workflows)

This ensures the runner stays current with supported Node.js versions while maintaining dual-version compatibility for GitHub Actions.

Copilot AI review requested due to automatic review settings September 9, 2025 12:54
@salmanmkc salmanmkc requested a review from a team as a code owner September 9, 2025 12:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an automated workflow to keep Node.js versions current by detecting new LTS releases and creating pull requests with necessary updates.

  • Automated Node.js version management for both Node 20.x and 24.x LTS versions
  • Weekly scheduling with manual trigger support and smart change detection
  • Automated PR creation with proper documentation and reminders for alpine_nodejs releases

id: node-versions
run: |
# Get latest versions from the versions manifest
VERSIONS_JSON=$(curl -s https://github.com/actions/node-versions/main/versions-manifest.json)
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl command lacks error handling. If the API is unavailable or returns invalid JSON, the workflow will fail silently or produce unexpected results. Consider adding error checking with curl -f flag and validating the JSON response.

Suggested change
VERSIONS_JSON=$(curl -s https://github.com/actions/node-versions/main/versions-manifest.json)
VERSIONS_JSON=$(curl -sf https://github.com/actions/node-versions/main/versions-manifest.json) || { echo "Error: Failed to fetch Node versions manifest."; exit 1; }
# Validate that the fetched content is valid JSON
echo "$VERSIONS_JSON" | jq empty || { echo "Error: Fetched manifest is not valid JSON."; exit 1; }

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +54
CURRENT_NODE20=$(grep "NODE20_VERSION=" src/Misc/externals.sh | cut -d'"' -f2)
CURRENT_NODE24=$(grep "NODE24_VERSION=" src/Misc/externals.sh | cut -d'"' -f2)
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep commands could fail if the NODE20_VERSION or NODE24_VERSION variables don't exist in externals.sh, causing the workflow to fail. Add error handling or use grep with the -o flag to ensure proper extraction.

Suggested change
CURRENT_NODE20=$(grep "NODE20_VERSION=" src/Misc/externals.sh | cut -d'"' -f2)
CURRENT_NODE24=$(grep "NODE24_VERSION=" src/Misc/externals.sh | cut -d'"' -f2)
CURRENT_NODE20=$(grep -oP 'NODE20_VERSION="\K[^"]+' src/Misc/externals.sh || true)
CURRENT_NODE24=$(grep -oP 'NODE24_VERSION="\K[^"]+' src/Misc/externals.sh || true)

Copilot uses AI. Check for mistakes.
salmanmkc added a commit to salmanmkc/runner that referenced this pull request Sep 9, 2025
## NPM Audit Fix with TypeScript Auto-Repair
- Automated security vulnerability detection and fixes for hashFiles dependencies
- Intelligent TypeScript compatibility auto-repair after npm updates
- Graduated response strategy for different vulnerability severities
- Weekly schedule (Mondays at 7 AM) plus manual triggers

## Key Features
- ✅ **Security-focused**: Only creates PRs when moderate+ vulnerabilities found
- ✅ **TypeScript auto-repair**: Fixes @types/node compatibility issues automatically
- ✅ **Multi-step recovery**: Clean reinstall, dependency resolution, build verification
- ✅ **Graduated response**: force-fix for critical/high vulnerabilities only
- ✅ **Build validation**: Ensures code compiles after automated fixes
- ✅ **Enhanced PR details**: Shows audit status, fixes applied, build status

## Security Enhancements
- ✅ **Proper error handling**: No vulnerability masking with '|| true'
- ✅ **Transparent reporting**: Clear distinction between success/partial/failed states
- ✅ **Audit level checking**: moderate, high, critical severity handling
- ✅ **Force-fix safety**: Only for critical/high vulnerabilities

## Dependencies
- **Requires**: Labels from actions#4024 (dependency, security, typescript, needs-manual-review)
- **Integrates with**: Monitoring from actions#4025
- **Complements**: Node version management from actions#4026

This workflow ensures npm dependencies stay secure while maintaining TypeScript compatibility and build stability.
id: node-versions
run: |
# Get latest versions from the versions manifest
VERSIONS_JSON=$(curl -s https://github.com/actions/node-versions/main/versions-manifest.json)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use https://github.com/actions/alpine_nodejs/releases and https://github.com/nodejs/node/releases to help decide which version is good for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, updated

ALPINE_RELEASES=$(curl -s https://api.github.com/repos/actions/alpine_nodejs/releases | jq -r '.[].tag_name')

if ! echo "$ALPINE_RELEASES" | grep -q "^node20-$LATEST_NODE20$"; then
echo "Warning: Node 20 version $LATEST_NODE20 not found in alpine_nodejs releases"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use the warning command?
ex:
echo "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

## Node.js Version Upgrade Workflow
- Automatically checks for latest Node 20.x and 24.x versions
- Updates NODE20_VERSION and NODE24_VERSION in src/Misc/externals.sh
- Creates PRs when newer versions are available
- Weekly schedule (Mondays at 6 AM) plus manual triggers

## Key Features
- ✅ Dual Node version support (Node 20 LTS + Node 24 LTS)
- ✅ Fetches versions from actions/node-versions manifest
- ✅ Smart change detection (only creates PR if versions differ)
- ✅ Proper git operations with --no-verify for automated commits
- ✅ Includes alpine_nodejs release reminder for manual follow-up

## Dependencies
- Requires dependency labels from actions#4024
- Works with monitoring from actions#4025

This workflow ensures the runner stays current with supported Node.js versions while maintaining dual-version compatibility.
## Enhanced Version Detection Strategy
- **Primary source**: Official Node.js GitHub releases API
- **Compatibility check**: Verify versions exist in alpine_nodejs releases
- **Smart fallback**: Use latest available alpine version if official version not ready

## Key Improvements
- ✅ More reliable than third-party versions manifest
- ✅ Ensures alpine_nodejs compatibility before updating
- ✅ Prevents workflow failures from version mismatches
- ✅ Better logging and error handling
- ✅ Uses official GitHub APIs for both Node.js and alpine_nodejs

## Sources Used
- Node.js releases: https://github.com/nodejs/node/releases
- Alpine compatibility: https://github.com/actions/alpine_nodejs/releases

This approach provides better control and reliability for Node.js version management while ensuring container compatibility.
@TingluoHuang TingluoHuang force-pushed the feature/nodejs-dependency-management branch from 27c5605 to f32279f Compare September 10, 2025 20:50
@salmanmkc salmanmkc enabled auto-merge (squash) September 10, 2025 20:51
@salmanmkc salmanmkc merged commit 646da70 into actions:main Sep 10, 2025
8 checks passed
fmartinez255 pushed a commit to TiVo/actions-runner that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants