docker / metadata-action

GitHub Action to extract metadata (tags, labels) from Git reference and GitHub events for Docker
https://github.com/marketplace/actions/docker-metadata-action
Apache License 2.0
911 stars 118 forks source link

Images cannot be empty as documentation suggests #379

Closed olee closed 9 months ago

olee commented 9 months ago

Contributing guidelines

I've found a bug, and:

Description

The documentation describes that images input can be empty so that only tags are generated: https://github.com/docker/metadata-action/blob/releases/v4/README.md#images-input

However, when actually not defining images, github will complain because the property is set as required and defining it as an empty string will also result in the same error message: Error: images input required

This can also be observed in the action definiton as required is set to true: https://github.com/docker/metadata-action/blob/releases/v4/action.yml#L14-L16

Here an example step which will result in the error:

      - id: meta
        uses: docker/metadata-action@v4
        with:
          tags: |
            type=sha

Expected behaviour

The images input is not defined as required and works as the documentation describes

Actual behaviour

Error: images input required

Repository URL

No response

Workflow run URL

No response

YAML workflow

jobs:
  build_and_push_images:
    steps:
      - id: meta
        uses: docker/metadata-action@v4
        with:
          tags: |
            type=sha

Workflow logs

Run docker/metadata-action@v[4](https://github.com/..../..../actions/runs/..../job/....#step:7:4)
  with:
    images:  
    tags: type=sha
  type=ref,event=pr
  type=ref,event=branch
  type=semver,pattern={{version}}
  type=semver,pattern={{major}}.{{minor}}
  type=semver,pattern={{major}},enable=true

    context: workflow
    github-token: ***
Error: images input required

BuildKit logs

No response

Additional info

No response

olee commented 9 months ago

I noticed just now, that the empty images seem to be a feature of v5 of this action which I didn't know exists because I checked for release git tags instead of checking the releases tag. Sorry