Hard-Hat Helper #45
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: Plagiarism Checker | |
on: | |
pull_request: | |
paths: | |
- "games/**/*.js" | |
jobs: | |
plagiarism-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Compare50 && beautifulsoup4 | |
run: pip install compare50 beautifulsoup4 | |
- name: Get list of changed files | |
id: changed-files | |
run: | | |
base_sha="${{ github.event.pull_request.base.sha }}" | |
head_sha="${{ github.event.pull_request.head.sha }}" | |
js_files=$(git diff --name-only --diff-filter=AM $base_sha..$head_sha | grep 'games/.*\.js$' | xargs) | |
echo "FILES=$js_files" >> $GITHUB_ENV | |
- name: Run Plagiarism Detection Script | |
run: python .github/scripts/plagiarism_check.py ${{ env.FILES }} games output_dir saved_dir | |
- name: Extract and Display Similarity Percentages | |
run: python .github/scripts/extract_percentages.py saved_dir/ | |
id: extract-percentages | |
- name: Upload Compare50 Results as Artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compare50-results | |
path: saved_dir/ | |
- name: Check for High Plagiarism Percentages | |
if: steps.extract-percentages.outcome == 'failure' | |
run: echo "Plagiarism percentage over threshold detected." |