-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.91 KB
/
Copy pathunicode-detector.yaml
File metadata and controls
58 lines (50 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Unicode Detector
on:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
jobs:
unicode-detector:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup uv
uses: astral-sh/setup-uv@e06108dd0aef18192324c70427afc47652e63a82 # v7.5.0
with:
enable-cache: false
- name: Collect added and modified files
id: changed-files
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
# Scan the full current PR diff, not just the most recent push.
# This keeps the file list correct for batched commits and force-pushes.
BASE_SHA=$(git merge-base "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
git diff --name-only --diff-filter=AMR "$BASE_SHA" "$HEAD_SHA" > changed_unicode_files.txt
else
echo "Unsupported event: ${{ github.event_name }}" >&2
exit 1
fi
if [ -s changed_unicode_files.txt ]; then
echo "has_files=true" >> "$GITHUB_OUTPUT"
echo "Scanning these paths:"
cat changed_unicode_files.txt
else
echo "has_files=false" >> "$GITHUB_OUTPUT"
echo "No added or modified files to scan."
fi
- name: Run unicode detector on changed files
if: steps.changed-files.outputs.has_files == 'true'
run: uv run unicode-detector --files-from changed_unicode_files.txt