metadata-action: The suggested default branch example does not work for schedule

tags: |
  type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}

Here is an example:

https://github.com/felipecrs/jenkins-agent-dind/blob/master/.github/workflows/ci.yml#L35

https://github.com/felipecrs/jenkins-agent-dind/runs/5964649319?check_suite_focus=true#step:3:31

I would say that this variable does not get filled properly for schedule events, which is meaningful, as metadata-action relies on it.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Yes let’s keep it that way in the meantime. Will see if there is some traction from other users for this pattern.

I would even add the is_default_branch to the list of outputs of the action, so that it can be also consumed in other parts of the workflow. As an useful helper.

This action is not a general purpose one for other steps and only exposes what it does. It should be done upstream by GitHub.

I think that the first approach would be fine, if we knew that schedule is the only outlier. I wonder what happens for other events, as there are many.

I have many fixtures too that covers most of them or at least most important imo: https://github.com/docker/metadata-action/tree/master/__tests__/fixtures