Description
Note to incoming readers (2025)
I will update this if anything changes, you don't need to read this entire thread.
Update March 2025
@salilsub, a GitHub Staff member, has said that this is coming in the latter half of 2025!!
Update Jan 2025
@salilsub started a Poll Comment to request interest in one of three proposed solutions.
🎉 : I need YAML anchors per the YAML spec
🚀 : I need a way to write YAML once and re-use it. I don't need YAML anchors specifically, but I need to have a way to do this in the same file as my workflow
👀 : I need a way to write YAML once and re-use it in my workflows. I can use either the same file or a different file I import. I really need templating (like the kind available in Azure DevOps Pipelines)
A deadline for the poll has been set for the end of February. Personally, I think this poll is an inappropriate response this this issue.
Update Aug 2024
This comment from staff says they will be looking at this next year
Thanks for engaging on this all, this is on our list to get to in the early part of next year. Right now we are re-working the services in Actions which do our YAML expansion (focusing on how we improve their availability). Once we are live with the new services we will start looking at adding features and this is on our list <3
How Can I Help?
If you want to help, upvote this comment by reacting to it with 👍. This will help it sort higher in the issues list.
Adding "me too" or "+1" comments does not help. Issues are not sorted by the number of comments, they are sorted by the number of reactions to the top issue comment (this comment). The only thing you accomplish by adding "me too", or "+1" is to send an email to issue subscribers (the other people who have commented, not staff). This will not help the issue get done faster, and may cause users to unsubscribe from this issue, reducing visibility. Comments are already being collapsed, please don't add noise to the signal.
Original Issue
Describe the enhancement
Support YAML anchors in in workflow files
Code Snippet
- env: &docker_cred
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
# ...
- env:
<<: *docker_cred
OR
anchors:
docker_hub_credentials: &docker_hub_credentials
credentials:
username: my-dockerhub-username
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
postgres_service: &postgres_service
postgres:
image: mdillon/postgis:9.6
<<: *docker_hub_credentials
Additional information
This has been asked for before, in other places
Note to implementors
This is generally handled by YAML parsers automatically. Perhaps it has been disabled, or a parser that does not support it is being used. This might be as simple as switching YAML parsers.