We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Trigger name collision workaround
This addresses the jinja trigger name collision noted in issue #4641

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `contrib/core/actions/inject_trigger.py`
Content:
```
1 # Copyright 2020 The StackStorm Authors.
2 # Copyright 2019 Extreme Networks, Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from __future__ import absolute_import
17 
18 from st2common.runners.base_action import Action
19 
20 __all__ = ["InjectTriggerAction"]
21 
22 
23 class InjectTriggerAction(Action):
24     def run(self, trigger, payload=None, trace_tag=None):
25         payload = payload or {}
26 
27         datastore_service = self.action_service.datastore_service
28         client = datastore_service.get_api_client()
29 
30         # Dispatch the trigger using the /webhooks/st2 API endpoint
31         # NOTE: Webhooks API endpoint is asynchronous so we don't know if the actual injection
32         # results in a TriggerInstanceDB database object creation or not. The object is created
33         # inside rulesengine service and could fail due to the user providing an invalid trigger
34         # reference or similar.
35         self.logger.debug(
36             'Injecting trigger "%s" with payload="%s"' % (trigger, str(payload))
37         )
38         result = client.webhooks.post_generic_webhook(
39             trigger=trigger, payload=payload, trace_tag=trace_tag
40         )
41 
42         return result
43
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/contrib/core/actions/inject_trigger.py b/contrib/core/actions/inject_trigger.py
--- a/contrib/core/actions/inject_trigger.py
+++ b/contrib/core/actions/inject_trigger.py
@@ -21,7 +21,7 @@
 
 
 class InjectTriggerAction(Action):
-    def run(self, trigger, payload=None, trace_tag=None):
+    def run(self, trigger=None, trigger_name=None, payload=None, trace_tag=None):
         payload = payload or {}
 
         datastore_service = self.action_service.datastore_service
@@ -32,6 +32,18 @@
         # results in a TriggerInstanceDB database object creation or not. The object is created
         # inside rulesengine service and could fail due to the user providing an invalid trigger
         # reference or similar.
+
+        # Raise an error if both trigger and trigger_name are specified
+        if trigger and trigger_name:
+            raise ValueError(
+                "Parameters `trigger` and `trigger_name` are mutually exclusive."
+            )
+
+        # Raise an error if neither trigger nor trigger_name are specified
+        if not trigger and not trigger_name:
+            raise ValueError("You must include the `trigger_name` parameter.")
+
+        trigger = trigger if trigger else trigger_name
         self.logger.debug(
             'Injecting trigger "%s" with payload="%s"' % (trigger, str(payload))
         )

{"golden_diff": "diff --git a/contrib/core/actions/inject_trigger.py b/contrib/core/actions/inject_trigger.py\n--- a/contrib/core/actions/inject_trigger.py\n+++ b/contrib/core/actions/inject_trigger.py\n@@ -21,7 +21,7 @@\n \n \n class InjectTriggerAction(Action):\n-    def run(self, trigger, payload=None, trace_tag=None):\n+    def run(self, trigger=None, trigger_name=None, payload=None, trace_tag=None):\n         payload = payload or {}\n \n         datastore_service = self.action_service.datastore_service\n@@ -32,6 +32,18 @@\n         # results in a TriggerInstanceDB database object creation or not. The object is created\n         # inside rulesengine service and could fail due to the user providing an invalid trigger\n         # reference or similar.\n+\n+        # Raise an error if both trigger and trigger_name are specified\n+        if trigger and trigger_name:\n+            raise ValueError(\n+                \"Parameters `trigger` and `trigger_name` are mutually exclusive.\"\n+            )\n+\n+        # Raise an error if neither trigger nor trigger_name are specified\n+        if not trigger and not trigger_name:\n+            raise ValueError(\"You must include the `trigger_name` parameter.\")\n+\n+        trigger = trigger if trigger else trigger_name\n         self.logger.debug(\n             'Injecting trigger \"%s\" with payload=\"%s\"' % (trigger, str(payload))\n         )\n", "issue": "Trigger name collision workaround\nThis addresses the jinja trigger name collision noted in issue #4641\n", "before_files": [{"content": "# Copyright 2020 The StackStorm Authors.\n# Copyright 2019 Extreme Networks, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\n\nfrom st2common.runners.base_action import Action\n\n__all__ = [\"InjectTriggerAction\"]\n\n\nclass InjectTriggerAction(Action):\n    def run(self, trigger, payload=None, trace_tag=None):\n        payload = payload or {}\n\n        datastore_service = self.action_service.datastore_service\n        client = datastore_service.get_api_client()\n\n        # Dispatch the trigger using the /webhooks/st2 API endpoint\n        # NOTE: Webhooks API endpoint is asynchronous so we don't know if the actual injection\n        # results in a TriggerInstanceDB database object creation or not. The object is created\n        # inside rulesengine service and could fail due to the user providing an invalid trigger\n        # reference or similar.\n        self.logger.debug(\n            'Injecting trigger \"%s\" with payload=\"%s\"' % (trigger, str(payload))\n        )\n        result = client.webhooks.post_generic_webhook(\n            trigger=trigger, payload=payload, trace_tag=trace_tag\n        )\n\n        return result\n", "path": "contrib/core/actions/inject_trigger.py"}], "after_files": [{"content": "# Copyright 2020 The StackStorm Authors.\n# Copyright 2019 Extreme Networks, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\n\nfrom st2common.runners.base_action import Action\n\n__all__ = [\"InjectTriggerAction\"]\n\n\nclass InjectTriggerAction(Action):\n    def run(self, trigger=None, trigger_name=None, payload=None, trace_tag=None):\n        payload = payload or {}\n\n        datastore_service = self.action_service.datastore_service\n        client = datastore_service.get_api_client()\n\n        # Dispatch the trigger using the /webhooks/st2 API endpoint\n        # NOTE: Webhooks API endpoint is asynchronous so we don't know if the actual injection\n        # results in a TriggerInstanceDB database object creation or not. The object is created\n        # inside rulesengine service and could fail due to the user providing an invalid trigger\n        # reference or similar.\n\n        # Raise an error if both trigger and trigger_name are specified\n        if trigger and trigger_name:\n            raise ValueError(\n                \"Parameters `trigger` and `trigger_name` are mutually exclusive.\"\n            )\n\n        # Raise an error if neither trigger nor trigger_name are specified\n        if not trigger and not trigger_name:\n            raise ValueError(\"You must include the `trigger_name` parameter.\")\n\n        trigger = trigger if trigger else trigger_name\n        self.logger.debug(\n            'Injecting trigger \"%s\" with payload=\"%s\"' % (trigger, str(payload))\n        )\n        result = client.webhooks.post_generic_webhook(\n            trigger=trigger, payload=payload, trace_tag=trace_tag\n        )\n\n        return result\n", "path": "contrib/core/actions/inject_trigger.py"}]}