How to display the branch where the action is manually triggered?

For automatically triggered action, it shows the branch name in the action list. But for manually triggered action, it’s empty. How to display the branch name?

Do you refer to workflows triggers by workflow_dispatch? You can use an expression ${{ github.event.workflow_dispatch.ref }} in that case to get the branch name in the format refs/heads/<branch-name>. That’s the branch that you dispatched the workflow for.

This information should also be available via ${{ github.ref }} or the environment variable GITHUB_REF. It’s the branch (or tag) ref that triggered the workflow run. Also see github context and Default environment variables.