Skip to content

Space jam sprig game #1996

Space jam sprig game

Space jam sprig game #1996

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: |
echo "Pull Request Base SHA: ${{ github.event.pull_request.base.sha }}"
echo "Pull Request Head SHA: ${{ github.event.pull_request.head.sha }}"
git diff --name-only --diff-filter=AM --find-renames --find-copies ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep 'games/.*\.js$' | xargs
js_files=$(git diff --name-only --diff-filter=AM --find-renames --find-copies ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep 'games/.*\.js$' | xargs)
echo "FILES=$js_files" >> $GITHUB_ENV
- name: Run Plagiarism Detection Script
if: env.FILES != ''
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@v4
with:
name: compare50-results
path: saved_dir/
- name: Save PR number to file
if: always()
run: echo ${{ github.event.pull_request.number }} > pr_number.txt
- name: Upload PR Number as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-number
path: pr_number.txt
- name: Upload Plagiarism Report as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: plagiarism-report
path: plagiarism-report.md
- name: Check for High Plagiarism Percentages
if: always() && steps.extract-percentages.outcome == 'failure'
run: echo "Plagiarism percentage over threshold detected."