Skip to content

Conversation

@mokagio
Copy link
Contributor

@mokagio mokagio commented Jan 16, 2026

What does it do?

I tried running the screenshot annotation on my end and it failed. Internal ref p1768453313053599/1768288277.528279-slack-CC7L49W13.

The reason it failed is that I didn't have screenshots images to annotate. That's obvious in hindsight, but it took me a bit to understand in between the dense logs.

This PR tracks the changes I made to cleanup the logs.

Note

As discussed in the thread, I haven't been able to test the changes yet in terms of actually calling down to ImageMagick. Still, I'd appreciate your feedback.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable. — N.A.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider. — N.A.

Otherwise, every hit (and there are many) of the method would print the
path in the logs. Example:

```
[20:09:25]: -------------------------------
[20:09:25]: --- Step: promo_screenshots ---
[20:09:25]: -------------------------------
[20:09:25]: Creating Promo Screenshots
/opt/homebrew/bin/drawText
[20:09:25]: ✅ Original Screenshot Source: /Users/gio/Developer/a8c/wcios/fastlane/screenshots
/opt/homebrew/bin/drawText
[20:09:25]: ✅ Translation source: /Users/gio/Developer/a8c/wcios/fastlane/metadata
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
[20:09:26]: ▸  ✅ Font "Helvetica Neue" found and active
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
[20:09:26]: ✅ Output Folder: /Users/gio/Developer/a8c/wcios/fastlane/promo_screenshots
/opt/homebrew/bin/drawText
[20:09:26]: 💙 Creating Promo Screenshots for: ar-SA, de-DE, en-US
[20:09:26]: Do you want to overwrite the existing promo screenshots? (y/n)
y
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/opt/homebrew/bin/drawText
/Users/gio/Developer/a8c/wcios/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb:410: warning: passing a block without an image argument is deprecated
...
```
Felt pretty dumb when I looked in the screenshots folder and realized
that it was empty because, duh, I didn't run the automation.
Doing so prevents printing the long `drawText` message and making the
logs noisy.

I tried using `command:` and `log: false` to silence that (as per
fastlane/fastlane#14945) but it didn't work.
@dangermattic
Copy link
Collaborator

dangermattic commented Jan 16, 2026

1 Warning
⚠️ Please add an entry in the CHANGELOG.md file to describe the changes made by this PR

Generated by 🚫 Danger

end

UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText')
UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText > /dev/null')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise, we'd get a long list of command -v drawText output.

As a side note, this line seems to be called many times. We should cache, memoize, or otherwise implement a way to run this check only once.

Comment on lines -290 to +299
Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}")
system(
'drawText',
"html=#{text}",
"maxWidth=#{width}",
"maxHeight=#{height}",
"output=#{temp_text_file.path}",
"fontSize=#{font_size}",
"stylesheet=#{stylesheet_path}",
"alignment=#{position}"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fastlane's sh should support logs: false to silence the call, but it did not parse.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be just log: false, per docs and source?

Comment on lines -410 to 422
Image.new(width, height) do
self.background_color = working_background
Image.new(width, height) do |info|
info.background_color = working_background
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This addresses a deprecation warning. See commit message for more details.

message = <<~MESSAGE
Unable to locate #{path}.
Did you run the automation to generate the screenshots?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just in case I go through the same process of pondering why annotating non existing screenshots fails again.

Did you run the automation to generate the screenshots?
MESSAGE
UI.user_error!(message)
Copy link
Contributor Author

@mokagio mokagio Jan 16, 2026

Choose a reason for hiding this comment

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

Used user_error! instead of crash! because it makes less noise in the logs as it doesn't give a stacktrace.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good one 👍

@mokagio mokagio requested review from iangmaia and twstokes January 16, 2026 05:22
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.

4 participants