The logic doesn't work since the main branch is protected.
See https://stackoverflow.com/questions/69263843/how-to-push-to-protected-main-branches-in-a-github-action for ideas on how to set up a GitHub App that could take care of this.
The action will work on branches on workflow_dispatch but not on release (since that pushes to main)