Skip to content

Commit bb422f2

Browse files
committed
refactor(ci|tests): improve validation coverage and refine workflows
- Add unit test for handling headers without trailing newlines. - Simplify `.github/workflows/pre-commit.yml` by removing unused triggers. - Update `.github/workflows/main.yml` to enforce correct gating and improve clarity.
1 parent 43db759 commit bb422f2

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: Build application
22

33
on:
44
push:
5-
pull_request:
5+
branches:
6+
- master
7+
workflow_run:
8+
workflows: ["PR Compliance"]
9+
types: [completed]
610
merge_group:
711
schedule:
812
- cron: '0 0 * * *'
@@ -17,6 +21,7 @@ concurrency:
1721
1822
jobs:
1923
pre-commit:
24+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
2025
uses: ./.github/workflows/pre-commit.yml
2126
ubuntu:
2227
needs:

.github/workflows/pre-commit.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
name: Pre-commit checks
22

33
on:
4-
push:
54
workflow_call:
6-
workflow_run:
7-
workflows: ["PR Compliance"]
8-
types: [completed]
95

106
jobs:
117
pre-commit:
12-
if: >-
13-
${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
148
runs-on: ubuntu-24.04
159
container:
1610
image: ghcr.io/learning-process/ppc-ubuntu:1.1

tests/test_validate_pr_main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def test_load_event_payload(self):
6060
finally:
6161
os.unlink(path_ok)
6262

63+
def test_split_headers_without_trailing_newline(self):
64+
# Cover branch where a header has no trailing newline at EOF
65+
body = "## 1. Full name and group"
66+
sections = self.v._split_sections_by_headers(body)
67+
self.assertIn("## 1. Full name and group", sections)
68+
6369

6470
class DummyHTTPResponse:
6571
def __init__(self, payload: bytes):

0 commit comments

Comments
 (0)