Skip to content

Commit 542ffb1

Browse files
authored
Dev (#34)
* Fix label positioning * Make code more readable, better docstrings, make code "strongly-typed" * Add gh actions * Modernize build process * Update gh action for black * Format files with black, update workflow to create PR with black formatted code if code isn't formatted already * Fix pytest in gh action * Update black gh action to only create PR if black finds an issue
1 parent e3cb1f9 commit 542ffb1

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/black.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: Linthttps://github.com/shoumikchow/bbox-visualizer/pull/34/conflict?name=.github%252Fworkflows%252Fblack.yml&base_oid=8dbdb03a0f3c4d41b7135253ebeeaa0845a4b889&head_oid=277ad307e92b68c3a855728a7f11aeda4c5ed629
22

33
on: [push, pull_request]
44

@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
15-
ref: ${{ github.head_ref }}
15+
fetch-depth: 0
1616

1717
- name: Set up Python
1818
uses: actions/setup-python@v4
@@ -23,9 +23,18 @@ jobs:
2323
run: pip install black
2424

2525
- name: Run Black
26+
id: black
27+
continue-on-error: true
28+
run: |
29+
black --check bbox_visualizer/bbox_visualizer.py tests/test_bbox_visualizer.py
30+
echo "has_changes=$?" >> $GITHUB_OUTPUT
31+
32+
- name: Format with Black if needed
33+
if: steps.black.outputs.has_changes == '1'
2634
run: black bbox_visualizer/bbox_visualizer.py tests/test_bbox_visualizer.py
2735

2836
- name: Create Pull Request
37+
if: steps.black.outputs.has_changes == '1'
2938
uses: peter-evans/create-pull-request@v5
3039
with:
3140
commit-message: "style: format code with Black"
@@ -35,4 +44,6 @@ jobs:
3544
3645
This PR was automatically created by the Black formatting GitHub Action.
3746
branch: format-code-with-black
38-
delete-branch: true
47+
base: main
48+
delete-branch: true
49+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ jobs:
2626
uv pip install ".[dev]"
2727
2828
- name: Run tests
29-
run: uv pip run pytest
29+
run: |
30+
uv pip install pytest
31+
pytest
32+
3033
3134
build:
3235
needs: test

0 commit comments

Comments
 (0)