Skip to content

Commit

Permalink
FIX: always update trigger paths
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 16, 2024
1 parent 0fb5ae3 commit 1906abf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- main
- epic/*
paths:
- .constraints/py3.*.txt
- .pre-commit-config.yaml
workflow_dispatch:

Expand Down
11 changes: 9 additions & 2 deletions src/compwa_policy/check_dev_files/update_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ def overwrite_workflow(workflow_file: str) -> None:
)
yaml = create_prettier_round_trip_yaml()
expected_data = yaml.load(expected_workflow_path)
original_paths = expected_data["on"]["pull_request"]["paths"]
existing_paths = filter_patterns(original_paths)
if not existing_paths:
msg = (
"No paths defined for pull_request trigger. Expecting any of "
", ".join(original_paths)
)
raise ValueError(msg)
expected_data["on"]["pull_request"]["paths"] = existing_paths
if frequency == "outsource":
del expected_data["on"]["schedule"]
else:
paths = filter_patterns(expected_data["on"]["pull_request"]["paths"])
expected_data["on"]["pull_request"]["paths"] = paths
expected_data["on"]["schedule"][0]["cron"] = _to_cron_schedule(frequency)
workflow_path = CONFIG_PATH.github_workflow_dir / workflow_file
if not workflow_path.exists():
Expand Down

0 comments on commit 1906abf

Please sign in to comment.