Skip to content

New Crowdin updates #536

New Crowdin updates

New Crowdin updates #536

Workflow file for this run

name: Check for 'from plugins' imports and comment on PR
on:
pull_request:
types: [opened, reopened, synchronize, closed, edited]
jobs:
check-imports:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for 'from plugins' imports
id: check-imports
run: |
echo "Checking for 'from plugins' imports..."
result=$(grep -rl '^from plugins' --include='*.py' || echo "")
echo "Found files with 'from plugins' imports:"
echo "$result"
echo "$result" > result_files.txt
lines=$(grep -rn '^from plugins' --include='*.py' | wc -l)
echo "Counting lines..."
echo "$lines lines found."
echo "$lines" > result_lines.txt
# Set the outputs using environment files
echo "files=$(cat result_files.txt)" >> $GITHUB_ENV
echo "lines=$(cat result_lines.txt)" >> $GITHUB_ENV
- name: Set failure if imports found
if: env.files != ''
run: |
echo "Failing the job due to 'from plugins' imports"
exit 1
- name: Comment on PR with line count
if: env.files != ''
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const files = process.env.files;
const lines = process.env.lines;
const message = `Found 'from plugins' imports in ${lines} lines across the following files:\n${files}`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});