Skip to content

Commit a570cc4

Browse files
committed
Do not apply skip-unless-changed for cron triggers.
1 parent a37236a commit a570cc4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/taskgraph/optimize/strategies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def check(self, files_changed, patterns):
8080
return False
8181

8282
def should_remove_task(self, task, params, file_patterns):
83-
# pushlog_id == -1 - this is the case when run from a cron.yml job or on a git repository
84-
if params.get("repository_type") == "hg" and params.get("pushlog_id") == -1:
83+
# skip-unless-changed should not apply to cron tasks (there will never be file changes)
84+
if params.get("tasks_for") == "cron":
8585
return False
8686

8787
changed = self.check(params["files_changed"], file_patterns)

test/test_optimize_strategies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_index_search(caplog, responses, params, state, expires, expected, logs)
135135
{"files_changed": ["bar.txt"]}, ["foo.txt"], True, id="files don't match"
136136
),
137137
pytest.param(
138-
{"repository_type": "hg", "pushlog_id": -1, "files_changed": ["bar.txt"]},
138+
{"tasks_for": "cron", "files_changed": ["bar.txt"]},
139139
["foo.txt"],
140140
False,
141141
id="cron task",

0 commit comments

Comments
 (0)