Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/pr-text.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PR text

# This repo is public. A PR title or body must not carry internal paths, agent or message ids,
# or Vietnamese notes from the private workspace. Write what changed, why, and how it was checked.
on:
pull_request:
types: [opened, edited, reopened, synchronize]

permissions: {}

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Title and body carry no internal detail
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
shell: python3 {0}
run: |
import os, re, sys, unicodedata
rules = {
'private path (.internal/)': r'\.internal/',
'home path (~/)': r'~/',
'local path (/Users/)': r'/Users/',
'message id (m_...)': r'\bm_[0-9a-f]{8}\b',
'pane id (pNNN)': r'\bp[0-9]{3}\b',
'agent name (b-affitor-)': r'b-affitor-',
'agent name (cos-...)': r'\bcos-(board|monitor|affitor|oa|pidot|repo)\b',
# letters French and Spanish never use (â, ê, ô are left out; ă is kept, rare outside Vietnamese); text is NFC-normalised, matching ignores case
'Vietnamese text': r'[ăđơưĩũạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹ]',
}
bad = 0
for field in ('PR_TITLE', 'PR_BODY'):
text = unicodedata.normalize('NFC', os.environ.get(field) or '')
for n, line in enumerate(text.splitlines(), 1):
for name, pat in rules.items():
if re.search(pat, line, re.IGNORECASE):
print(f'::error::{field} line {n}: {name}')
bad += 1
sys.exit(1 if bad else 0)
Loading