The problem with reusable workflows

  • The calling workflow usually needs to pass data to the reusable workflow
  • GitHub limits the ways we can do that. Because security
  • GHA calls these workflow inputs
  • env/config data can be passed via with and secrets
  • Example:
jobs:
  call-docker-build:
    name: Call Docker Build
    uses: bretfisher/docker-build-workflow/.github/workflows/reusable-docker-build.yaml@main
    secrets:
      dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
      dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
    with:
      dockerhub-enable: true
      image-names: ghcr.io/${{ github.repository }}
      tag-rules: |
        type=ref,event=pr
        type=raw,value=gha-${{ github.run_id }}
slide 72 (click 0 of 9)