metadata-action icon indicating copy to clipboard operation
metadata-action copied to clipboard

workflow dispatch event for manual triggers

Open sudhirgajula-8451 opened this issue 3 years ago • 1 comments

I would like to trigger the builds manually using workflow_dispatch event.

Example: on: workflow_dispatch:

want to know whether workflow_dispatch is supported? Because under usage it doesn't list workflow_dispatch event (manual trigger), but only push, push tag & pull request events.

Any help would be much appreciated!

sudhirgajula-8451 avatar Aug 01 '22 18:08 sudhirgajula-8451

+1 for this.

The first thing needed here is really just a simple confirmation whether manually trigged workflows are expected to run as normal, or whether there may be an issue with a manually triggered workflow using this action that does not otherwise affect code push tirggered workflow which includes this action.

forestmars-8451 avatar Aug 08 '22 20:08 forestmars-8451

workflow_dispatch event is considered the same as a push event with this action as GITHUB_REF is always a branch:

  • https://github.com/docker/metadata-action/blob/master/tests/fixtures/event_workflow_dispatch.env
  • https://github.com/docker/metadata-action/blob/master/tests/fixtures/event_workflow_dispatch_dev.env

For example manually triggered buildx-977 workflow from main branch:

name: buildx-977

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Docker meta
        id: docker_meta
        uses: docker/metadata-action@v4
        with:
          images: [${{ env.LOCAL_SLUG }}](localhost:5000/name/app)

Will output the following tags: https://github.com/crazy-max/buildx-buildkit-tests/actions/runs/3207355576/jobs/5242149214#step:5:38

image

crazy-max avatar Oct 07 '22 20:10 crazy-max