Feat/update ai docs lang check action #5
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: Automatic Language Check | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
paths: | |
- '**.md' # Only trigger on markdown file changes | |
jobs: | |
lang-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Get full git history for diff comparison | |
- name: Setup Git | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "[email protected]" | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq curl | |
- name: Run language check script | |
env: | |
DIFY_API_KEY: ${{ secrets.DIFY_API_KEY }} | |
run: | | |
chmod +x ./lang-check/git-diff.sh | |
output=$(./lang-check/git-diff.sh) | |
echo "$output" # Display check results | |
# Check if output contains ❌ symbol | |
if echo "$output" | grep -q "❌"; then | |
# Clean up temporary file before exit | |
rm -f ./lang-check/commit-*.txt | |
echo "Check failed, PR cannot be merged" | |
exit 1 # Non-zero exit code will fail the Action | |
else | |
# Clean up temporary file before exit | |
rm -f ./lang-check/commit-*.txt | |
echo "Check passed" | |
exit 0 # Zero exit code indicates Action success | |
fi |