return filters
-def process_filter(filter_name, ci_name):
- execute = True
+def process_filter(execute_by_default, filter_name, ci_name):
+ execute = execute_by_default
# bot message is case insensitive (processed with lower case). so we also convert ci_name to lower case.
ci_name = ci_name.lower()
if __name__ == "__main__":
- need_to_execute = process_filter("BOT_STAGE_FILTER", os.getenv("CI_JOB_STAGE")) \
- and process_filter("BOT_JOB_FILTER", os.getenv("CI_JOB_NAME"))
+ execute_by_default = True
+ if os.getenv("BOT_NEEDS_TRIGGER_BY_NAME", "0") == "1":
+ execute_by_default = False
+
+ need_to_execute = process_filter(True, "BOT_STAGE_FILTER", os.getenv("CI_JOB_STAGE")) \
+ and process_filter(execute_by_default, "BOT_JOB_FILTER", os.getenv("CI_JOB_NAME"))
if need_to_execute:
sys.exit(0)
else: