Conditional Hook

I am trying to set up a hook that only fires on my production env to clear the cache.

Could you provide more details on how to do this?

I noticed there is a when: keyword in the .yml files of some of the hooks. Is there where I would put a conditional?

How would I change the code below to run this hook conditionally?

- name: Clear Kinsta cache
    url: "{{ site_env.wp_home }}/kinsta-clear-cache-all/"
    method: GET
    changed_when: {{ site_env.wp_home }} === ''

The third include file, deploy-hooks/sites/{{ site }}-build-after.yml , demonstrates how you could use a {{ site }} variable to include a file based on the name of the site being deployed, e.g.,

This topic was automatically closed after 42 days. New replies are no longer allowed.