feat: update rules #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- "**.json" | |
- "scripts/check.py" | |
- ".github/workflows/check.yml" | |
defaults: | |
run: | |
shell: bash -e {0} | |
jobs: | |
check-forbid: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.9" | |
enable-cache: true | |
- name: Check for forbidden file changes | |
run: | | |
forbidden_files=( | |
"rules.md" | |
"diff.md" | |
"bilibili-danmu-blocklist-output.json" | |
) | |
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) | |
for file in "${forbidden_files[@]}"; do | |
if echo "$changed_files" | grep -q "$file"; then | |
echo "Error: Forbidden file $file was modified in this PR." | |
exit 1 | |
fi | |
done | |
check-json: | |
needs: check-forbid | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.9" | |
enable-cache: true | |
- name: Set up Python | |
run: uv python install 3.13 | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Check the json file | |
run: uv run scripts/check.py |