Sake flush=1 not working as expected

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 3.6.1

Question: I have a Silverstripe 3.6.1 site that I am deploying via GitHub actions - and one of the last steps in the workflow is to rebuild the DB and flush the cache done like so:

$ sake dev/build "flush=1"

The rebuild works as expected, however the cache does not seem to flush properly - for example, a deploy last night resulted in a white screen on the homepage. It wasn’t until I managed to log in a flush via the URL that it worked as expected.

Am I using sake incorrectly?
Is what I’m trying to do not the intended behaviour?
Is a better way to flush the cache during deploy to empty the silverstripe-cache directory?

There’s a note in the SS4 docs which probably applies to SS3 as well:

You have to run “sake” with the same system user that runs your web server, otherwise “flush” won’t be able to clean the cache properly.

Maybe that is your problem?

for example, if your web root user is www-root, then you need to run sake with www-root, otherwise it won’t clear the right cache

Looks like that was it. Thanks.