Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable main tag when latest is enabled #347

Closed
rob93c opened this issue Oct 10, 2023 · 2 comments
Closed

Disable main tag when latest is enabled #347

rob93c opened this issue Oct 10, 2023 · 2 comments

Comments

@rob93c
Copy link

rob93c commented Oct 10, 2023

Description

While working on my Docker workflow, I noticed that when merging changes to my main (the default branch in my case) 2 tags are created: latest and main.

How can I prevent main's creation?

This is my configuration:

      - name: Extract metadata
        id: metadata
        uses: docker/metadata-action@v5
        with:
          images: |
            rob93c/stickerify
          tags: |
            type=raw,value=latest,enable={{is_default_branch}}
            type=ref,event=branch
            type=ref,event=pr
@polarathene
Copy link

Unfortunately it seems handlebars doesn't provide a ! operator, so you'd need the action to also provide {{is_not_default_branch}}, but for now you can hard-code the branch:

Try type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}? That should opt out.

@rob93c
Copy link
Author

rob93c commented Oct 15, 2023

Hi @polarathene and thank you for your help, I confirm your suggestion works as intended so to me the issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants