From e822496d11b872f7f21190281e04b848bc3833ab Mon Sep 17 00:00:00 2001 From: Richard Anderson Date: Sun, 25 May 2025 12:45:08 +0100 Subject: [PATCH 1/3] Introduce lint error to test PR process --- .github/workflows/pr.yml | 45 ++++++++++++++++++++++ .github/workflows/release.yml | 4 +- README.md | 8 +--- composer.json | 2 +- src/Console/Commands/MakeActionCommand.php | 3 +- 5 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..ff76418 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,45 @@ +name: Lint Check + +on: + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + name: Code Linting + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv + coverage: none + + - name: Cache Composer dependencies + uses: actions/cache@v3 + with: + path: ~/.composer/cache/files + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Install Composer dependencies + run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Run Laravel Pint + run: ./vendor/bin/pint --test --verbose + + - name: Add PR comment on failure + if: failure() + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '**Code formatting issues detected**\n\nPlease run `./vendor/bin/pint` to fix formatting issues before merging.' + }) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e76cde..a903cbe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,10 +54,10 @@ jobs: body=$(echo $response | sed -e 's/HTTPSTATUS\:.*//g') if [ "$http_code" -eq 200 ] || [ "$http_code" -eq 202 ]; then - echo "✅ Package submitted to Packagist successfully!" + echo "Package submitted to Packagist successfully!" echo "HTTP Status: $http_code" else - echo "❌ Failed to submit package to Packagist" + echo "Failed to submit package to Packagist" echo "HTTP Status: $http_code" echo "Response: $body" exit 1 diff --git a/README.md b/README.md index e4b9643..3f584e5 100644 --- a/README.md +++ b/README.md @@ -475,8 +475,8 @@ $user = RegisterUser::run($registrationData); ## Requirements -- PHP 8.1 or higher -- Laravel 9.0 or higher +- PHP 8.2 or higher +- Laravel 12.0 or higher ## Contributing @@ -489,7 +489,3 @@ This package is open-sourced software licensed under the [MIT license](LICENSE). ## Support If you discover any security vulnerabilities or bugs, please create an issue on GitHub. - ---- - -**LumoSolutions** - Making Laravel development more actionable. diff --git a/composer.json b/composer.json index f035f74..ea99d47 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "php": ">=8.2" }, "require-dev": { - "laravel/pint": "^1.0" + "laravel/pint": "^1.22" }, "extra": { "laravel": { diff --git a/src/Console/Commands/MakeActionCommand.php b/src/Console/Commands/MakeActionCommand.php index c552a05..e9a58ec 100644 --- a/src/Console/Commands/MakeActionCommand.php +++ b/src/Console/Commands/MakeActionCommand.php @@ -12,8 +12,7 @@ class MakeActionCommand extends BaseStubCommand protected $description = 'Create a new Action class'; - protected function subDirectory(): string - { + protected function subDirectory(): string { return 'Actions'; } From a39a488e2ddb184f7be273f1414b04582684d8fa Mon Sep 17 00:00:00 2001 From: Richard Anderson Date: Sun, 25 May 2025 12:48:37 +0100 Subject: [PATCH 2/3] Add permissions --- .github/workflows/pr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ff76418..121c37d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,6 +4,11 @@ on: pull_request: branches: [main] +permissions: + contents: read + issues: write + pull-requests: write + jobs: lint: runs-on: ubuntu-latest From 8cdf7c501226b653c8f922579e3a7a908a51bbb7 Mon Sep 17 00:00:00 2001 From: Richard Anderson Date: Sun, 25 May 2025 12:49:30 +0100 Subject: [PATCH 3/3] fixed lint error --- src/Console/Commands/MakeActionCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Console/Commands/MakeActionCommand.php b/src/Console/Commands/MakeActionCommand.php index e9a58ec..c552a05 100644 --- a/src/Console/Commands/MakeActionCommand.php +++ b/src/Console/Commands/MakeActionCommand.php @@ -12,7 +12,8 @@ class MakeActionCommand extends BaseStubCommand protected $description = 'Create a new Action class'; - protected function subDirectory(): string { + protected function subDirectory(): string + { return 'Actions'; }