Fix GitHub Actions failure by pinning to ubuntu-22.04 #2
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.
Problem
The GitHub Actions workflows were failing with the following error when trying to set up Ruby:
This caused the
build-siteworkflow to fail consistently on pushes to main, preventing the website from being built and deployed.Root Cause
GitHub recently migrated
ubuntu-latestfrom ubuntu-22.04 to ubuntu-24.04. Theruby/setup-rubyaction does not fully support ubuntu-24.04 yet, causing it to incorrectly identify the runner as self-hosted and expect Ruby to be pre-installed in$RUNNER_TOOL_CACHE, which caused the action to fail.Solution
Made two changes to both workflow files (
.github/workflows/build-site.yamland.github/workflows/build-preview.yaml):ruby/setup-rubyaction from v1.172.0 to v1.264.0 (latest version)runs-onfromubuntu-latesttoubuntu-22.04to explicitly pin to a known compatible runner versionBy explicitly using ubuntu-22.04 instead of relying on ubuntu-latest, we ensure the workflows run on a stable platform that the ruby/setup-ruby action fully supports, avoiding any compatibility issues with ubuntu-24.04.
Testing
This change ensures the workflows will run successfully on ubuntu-22.04 runners with proper Ruby setup support.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.