Skip to content

Commit

Permalink
FEAT: run workflow on "update pip constraints" comment (#252)
Browse files Browse the repository at this point in the history
* BREAK: remove concurrecy from workflow
  This is in case multiple comments are made about different topics
  • Loading branch information
redeboer authored Dec 10, 2023
1 parent 1da5980 commit 904e78c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/repoma/.github/workflows/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Requirements

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
issue_comment:
types:
- created
pull_request:
branches:
- main
Expand Down
6 changes: 6 additions & 0 deletions src/repoma/check_dev_files/update_pip_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- https://github.com/ComPWA/update-pre-commit
"""

from __future__ import annotations

from glob import glob

from repoma.check_dev_files.github_workflows import remove_workflow, update_workflow
from repoma.errors import PrecommitError
from repoma.utilities import CONFIG_PATH, REPOMA_DIR
Expand Down Expand Up @@ -43,7 +47,9 @@ def overwrite_workflow(workflow_file: str, cron_schedule: str) -> None:
)
yaml = create_prettier_round_trip_yaml()
expected_data = yaml.load(expected_workflow_path)
paths: list[str] = expected_data["on"]["pull_request"]["paths"]
expected_data["on"]["schedule"][0]["cron"] = cron_schedule
expected_data["on"]["pull_request"]["paths"] = [p for p in paths if glob(p)]
workflow_path = CONFIG_PATH.github_workflow_dir / workflow_file
if not workflow_path.exists():
update_workflow(yaml, expected_data, workflow_path)
Expand Down

0 comments on commit 904e78c

Please sign in to comment.