From e026be66788604d1278d99b9d9563ecfdd021ee8 Mon Sep 17 00:00:00 2001 From: Max Jonas Werner Date: Wed, 24 May 2023 16:28:10 +0200 Subject: [PATCH] note about registry_package firing multiple times (#22092) Co-authored-by: hubwriter --- .../events-that-trigger-workflows.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/content/actions/using-workflows/events-that-trigger-workflows.md b/content/actions/using-workflows/events-that-trigger-workflows.md index 20c84373b0..5c67242874 100644 --- a/content/actions/using-workflows/events-that-trigger-workflows.md +++ b/content/actions/using-workflows/events-that-trigger-workflows.md @@ -1041,7 +1041,21 @@ on: {% data reusables.actions.branch-requirement %} -Runs your workflow when activity related to {% data variables.product.prodname_registry %} occurs in your repository. For more information, see "[AUTOTITLE](/packages)." +{% note %} + +**Note**: When pushing multi-architecture container images, this event occurs once per manifest, so you might observe your workflow triggering multiple times. To mitigate this, and only run your workflow job for the event that contains the actual image tag information, use a conditional: + +{% raw %} +```yaml +jobs: + job_name: + if: ${{ github.event.registry_package.package_version.container_metadata.tag.name != '' }} +``` +{% endraw %} + +{% endnote %} + +Runs your workflow when activity related to {% data variables.product.prodname_registry %} occurs in your repository. For more information, see "[{% data variables.product.prodname_registry %} Documentation](/packages)." For example, you can run a workflow when a new package version has been `published`.