What is the correct process for custom automation?

I am a beginner and have some questions about the Create Custom Automations tutorial.

I first tried writing the automation script directly in the GitHub Codespace development environment (I don’t understand the syntax; the code was written by Claude).
After modification, the file structure should look like this:

plugins/automation/
├── lib/
│   └── discourse_automation/
│       ├── scripts.rb                 # Modified
│       └── scripts/
│           ├── ...                    # Other scripts
│           └── remove_expired_group_members.rb  # Added
└── config/
    └── locales/
        ├── server.en.yml              # Modified
        ├── client.en.yml              # Modified
        ├── server.zh_CN.yml           # Modified
        └── client.zh_CN.yml           # Modified

However, I am unsure if this operation is permissible in a production environment.
Furthermore, I am unsure if these modifications will be lost during a rebuild or an update to the automation plugin, so I dare not try it in the production environment. Perhaps I should submit a feature request for the plugin maintainers to add it?

I hope experienced friends can inform me about the correct procedure from writing tests to applying changes in the production environment.
Thank you very much!

I believe it will have to be in a new plugin.

You can check out:

לייק 1

I have checked the link you provided.
Could you please explain to me why I should use plugins instead of creating scripts within the automation plugin?

  1. I am not a professional, and creating plugins seems more difficult.
  2. I have many functions that need to be implemented, which seems like it would require creating many plugins? (Although I also like plugins because they can be shared.)

If I’m not wrong, if you make changes to the plugin, it will be overwritten the next time there’s an update.

לייק 1

OK, that’s what I was afraid of.
So the custom automation feature doesn’t seem to mean much to the user? :joy:
I’ll check the documentation again, and if that doesn’t work, I’ll try creating a plugin.

לייק 1

I think the tutorial (which is a draft) is lacking this information. It explains how to create new automations, but not where to do it. The answers mention plugin examples though, like the one linked by @NateDhaliwal.

Simon also suggests having a look at the data explorer plugin: Create custom Automations - #6 by simon.

Depends what you mean by “user”? :smile: As a developer, you can surely create a new plugin that adds automations. This is the way to do it properly.

Since you mention not understanding code, but being able to use AI for this, perhaps you’ll find this discussion interesting. Claude & Discourse-related development. How good is it?.

I’m currently experimenting with this (but I do have vague notions of code – not enough to create even a simple plugin by myself!), and will share my recent experience with it soon.

Since Claude directed you to edit the automation plugin, you may want to refine your prompts and have the AI follow actual good practices.

לייק 1