-
Notifications
You must be signed in to change notification settings - Fork 115
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
The suggested default branch example does not work for schedule #184
Comments
With a workaround for docker/metadata-action#184.
While the best would be for GitHub to fix it, I wonder if we should do something to make users aware of it before recommending it, or to use another approach. |
Can you add this step in your workflow and give me the output if possible please?: https://github.com/crazy-max/ghaction-dump-context#usage |
|
Ok so looking at their docs,
So I would say add this: tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'schedule' }} But I think we could add a global expression named tags: |
type=raw,value=latest,enable={{is_default_branch}} WDYT? |
I think that the first approach would be fine, if we knew that PS: I did it for my repository, as I know that I don't use anything but Having this said, I would conclude that this is not a reliable manner of obtaining the default branch at all (it's not even documented), and because of that, the second approach would be better indeed. I would even add the |
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 |
This action is not a general purpose one for other steps and only exposes what it does. It should be done upstream by GitHub. |
Absolutely understood. |
@felipecrs You can test with |
@crazy-max that's awesome. I made a few suggestions in the PR btw. |
@crazy-max, I'm a little concerned about the new tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }} Would only be enabled for tags: |
type=raw,value=latest,enable={{ is_default_branch }} Not only gets enabled for |
Indeed, I will change that. |
There is also some events like tags: |
type=raw,value=latest,enable={{ is_default_branch && event == "push" }} |
In my case, that's exactly what I want. And I think it's reasonable, after all The reason why |
Having that said, it would be interesting to be able to mix global exprs with the workflow expressions for more granular control. I just don't know if this is reason enough to bother introducing it (which I suppose will not be trivial). |
Yes let's keep it that way in the meantime. Will see if there is some traction from other users for this pattern. |
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.
The text was updated successfully, but these errors were encountered: