Is there any way to put the Slack's block kit template to another file, then have the .config.yml reference it?
quynhethereal opened this issue · 2 comments
Hi guys, first of all, thank you so much for your hard work. Everything works great, but the issue I'm having is that as I'm using the custom
tag to specify my custom Slack block kit template, the config.yml file becomes too lengthy. I was wondering if there is some way that I can put the templates in separate files, then reference it in my .config.yml workflow.
Hello @quynhethereal.
This should be possible, but I want to ask if one of our currently suggested methods would work for you, or even be better. The one downside to having files is they are per-repository. So you would need to copy them into multiple projects to reuse them. They also mean you would need to checkout your source code before sending a notification.
Alternatively, you could save the template as an environment variable in a "context" on CircleCI that can be shared across multiple projects and updated. https://github.com/CircleCI-Public/slack-orb/wiki/Reuse-Custom-Templates
In this case, you could even have a separate private github repo for just your Slack templates and use the CircleCI CLI to update the contexts, it could even be automated.
https://circleci.com/docs/contexts/#context-management-with-the-cli
Hey @KyleTryon, I missed that doc so thanks for pointing out that I can use CI env variable to manage Slack's templates! I think it is suitable for my use case, and the ability to manage such envs with CLI is the cherry on top. I will proceed to close this issue now 🙌