-
Notifications
You must be signed in to change notification settings - Fork 8
Use robust path when reading .ruby-version
#680
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
Conversation
Generated by 🚫 Danger |
Instead of hardcoding the Ruby version, read it from .ruby-version file using a path relative to the script location. This makes the script work correctly regardless of where it's sourced from. Co-authored-by: mokagio <1218433+mokagio@users.noreply.github.com>
.ruby-version
mokagio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that the interpolation remains correct, as CI is using 3.2.2:
@AliSoftware @iangmaia keen to hear what you think of:
- Using
.ruby-versionas the single source of truth - The path juggling
|
I'm ok with using The path juggling feels a bit ugly, but iinm that's how it's supposed to be done in bash (i.e. I've seen this pattern elsewhere in various occasions), as it covers the case of Another option would have been to leverage |



What does it do?
Addresses https://github.com/wordpress-mobile/release-toolkit/pull/677/files#r2583457311
The
.buildkite/shared-pipeline-varsscript hardcoded the Ruby version instead of reading from.ruby-version. This change uses${BASH_SOURCE[0]}to construct a location-independent path to.ruby-version, ensuring the script works regardless of the sourcing directory.Before:
After:
Checklist before requesting a review
Run(Shell script change only)bundle exec rubocopto test for code style violations and recommendations.Add Unit Tests (aka(No test infrastructure for shell scripts)specs/*_spec.rb) if applicable.Run(Shell script change only)bundle exec rspecto run the whole test suite and ensure all your tests pass.Make sure you added an entry in the(Internal tooling change)CHANGELOG.mdfile to describe your changes under the appropriate existing###subsection of the existing## Trunksection.If applicable, add an entry in the(Not applicable)MIGRATION.mdfile to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.Original prompt
.ruby-version#679💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.