Skip to content

Commit

Permalink
Merge branch 'main' into topic-composer-plugin-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbeaty authored Dec 5, 2024
2 parents 74e0ee5 + 54ddb56 commit 3f1454b
Show file tree
Hide file tree
Showing 3,488 changed files with 5,625 additions and 6,163 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
69 changes: 69 additions & 0 deletions .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Copyright Check

on:
pull_request:
push:

jobs:
check-copyright:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Skip OM commits
if: github.event_name == 'push'
id: skip_check
run: |
COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.sha }})
if [[ "$COMMIT_MSG" =~ ^OM\ PR ]]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Get changed files
id: changed-files
if: github.event_name == 'pull_request' || steps.skip_check.outputs.skip != 'true'
uses: tj-actions/changed-files@v45

- name: Check copyright in modified files
if: github.event_name == 'pull_request' || steps.skip_check.outputs.skip != 'true'
shell: bash
run: |
# Get current year
CURRENT_YEAR=$(date +%Y)
# Initialize error flag
ERROR=0
# Loop through each modified file
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
# Skip if file doesn't exist (was deleted)
if [ ! -f "$file" ]; then
continue
fi
# Only check files with specific extensions
extension="${file##*.}"
if ! [[ "${extension,,}" =~ ^(css|js|php|phtml|template|xml)$ ]]; then
continue
fi
# Check if file contains the copyright string with current year
# Pattern matches either:
# @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
# @copyright Copyright (c) (2024-)2024 Maho (https://mahocommerce.com)
if ! grep -E -q "Copyright \(c\) (\(2024-\))?${CURRENT_YEAR} Maho \(https://mahocommerce\.com\)" "$file"; then
echo "❌ Copyright notice missing in: $file"
ERROR=1
fi
done
# Exit with error if any file is missing copyright
if [ $ERROR -eq 1 ]; then
echo "❌ Error: Some files are missing the required copyright notice"
exit 1
fi
echo "✅ Success: All modified files contain the required copyright notice"
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// There MUST be one blank line after the namespace declaration.
'blank_line_after_namespace' => true,
// Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line.
'blank_line_after_opening_tag' => true,
'blank_line_after_opening_tag' => false,
// The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.
'braces' => true,
// Whitespace around the keywords of a class, trait or interfaces definition should be one space.
Expand Down
Loading

0 comments on commit 3f1454b

Please sign in to comment.