Skip to content

Commit fae70f6

Browse files
refactor: move ops/ scripts to .github/scripts/ (#369)
1 parent 8ac607c commit fae70f6

10 files changed

Lines changed: 16 additions & 12 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ hatch fmt
1515
echo SUCCESS: linting/fmt
1616

1717
# commit message validation
18-
python ops/lintcommit.py
18+
hatch run python .github/scripts/lintcommit.py
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# To run tests:
66
#
7-
# python -m pytest ops/tests/test_lintcommit.py
7+
# python -m pytest .github/scripts/tests/test_lintcommit.py
88

99
from __future__ import annotations
1010

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
from __future__ import annotations
44

5+
import os
6+
import sys
57
from subprocess import CompletedProcess
68
from unittest.mock import patch
79

10+
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
11+
812
import pytest
913

10-
from ops.lintcommit import lint_range, validate_message, validate_subject
14+
from lintcommit import lint_range, validate_message, validate_subject
1115

1216

1317
# region validate_subject: valid subjects
@@ -237,7 +241,7 @@ def test_lint_range_git_failure(mock_run) -> None:
237241
@patch("subprocess.run")
238242
def test_lint_range_dirty_worktree_skips(mock_run) -> None:
239243
"""When skip_dirty_check=False and worktree is dirty, validation is skipped."""
240-
mock_run.return_value = _completed(stdout=" M ops/lintcommit.py\n")
244+
mock_run.return_value = _completed(stdout=" M .github/scripts/lintcommit.py\n")
241245

242246
result = lint_range("origin/main..HEAD", skip_dirty_check=False)
243247

File renamed without changes.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
python-version: "3.12"
2626
- name: Lint commit messages
27-
run: python ops/lintcommit.py --range "origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}"
27+
run: python .github/scripts/lintcommit.py --range "origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}"
2828

2929
build:
3030
runs-on: ubuntu-latest

.github/workflows/test-parser.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Test Parser
33
on:
44
pull_request:
55
paths:
6-
- 'ops/parse_sdk_branch.py'
7-
- 'ops/tests/**'
6+
- '.github/scripts/parse_sdk_branch.py'
7+
- '.github/scripts/tests/**'
88
push:
99
branches: [ main ]
1010
paths:
11-
- 'ops/parse_sdk_branch.py'
12-
- 'ops/tests/**'
11+
- '.github/scripts/parse_sdk_branch.py'
12+
- '.github/scripts/tests/**'
1313

1414
permissions:
1515
contents: read
@@ -21,4 +21,4 @@ jobs:
2121
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222

2323
- name: Run parser tests
24-
run: python ops/tests/test_parse_sdk_branch.py
24+
run: python .github/scripts/tests/test_parse_sdk_branch.py

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ hatch fmt
2727

2828
There is a convenience script for the above that you can run from the root of the repo as you prepare your PR:
2929
```
30-
ops/ci-checks.sh
30+
.github/scripts/ci-checks.sh
3131
```
3232

3333
This script also validates your commit messages against the [Conventional Commits](https://www.conventionalcommits.org/) format.
3434
Commit all your changes before you run the check. If your working directory is dirty the script will skip commit message validation with a warning.
3535

3636
You can also run the commit message check independently:
3737
```
38-
python ops/lintcommit.py
38+
hatch run python .github/scripts/lintcommit.py
3939
```
4040

4141
## Coding Standards

0 commit comments

Comments
 (0)