Dynamic GitHub Action Name
How to dynamically name a GitHub Action
I've worked on a project that had a deployment script triggered by a GitHub Action. The action had a select input that let you choose the environment to deploy to (e.g., staging
, prod
). Whenever I wanted to deploy to both environments, I had to run the action twice, once for each environment. Because of this, when I went back to the history of previously run actions, I couldn't tell which action was for prod
and which was for staging
.
So I came up with an idea to dynamically name the action based on the environment it's deploying to. At first, I thought it was impossible, but then quickly found out that it's actually quite simple, as GitHub recently added this feature.
The only thing you need to do is to add run-name
to the action.
name: Deployment
run-name: Deployment to ${{ inputs.environment }} by ${{ inputs.user }}
Docs: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#run-name
Published on May 21, 2025 • 1 min read