Search code examples
githubgithub-actions

add variable value to github action name


How do I create a github workflow step name with a variable value.

I tried this but it does not work.

name: Publish
on:
  push:
    branches:
      - main
env:
  REGISTRY: ghcr.io

jobs:
  Publish:
    runs-on: ubuntu-latest
    steps:
      - name: Log into Container registry ${{ env.REGISTRY }}

Solution

  • I know you tried it, but reproducing the workflow here with your implementation (as below) actually worked for me.

    name: Publish
    
    on:
      push:
    
    env:
      REGISTRY: ghcr.io
    
    jobs:
      Publish:
        runs-on: ubuntu-latest
        steps:
          - name: Log into Container registry ${{ env.REGISTRY }}
            run: echo "Ok"
    

    The job step name was generated dynamically according to the workflow env variable set.

    Here is the workflow run

    evidence