Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PHPCS

on:
pull_request:
paths:
- '**.php'
Comment on lines +4 to +6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked this against both tools' own docs rather than changing it on faith: GitHub's own path-filter syntax docs give **.js as the documented example for "all .js files in the repository" (i.e. it already matches nested paths, no leading **/ needed) — same semantics apply to **.php in the on.pull_request.paths filter. And tj-actions/changed-files' own README (the files: input used in the second step) has an identical example, **.md, specifically captioned "Get all changed markdown files" including nested ones under docs/ — it explicitly adopted GitHub's native glob semantics as of v13, not minimatch's. So **.php already matches nested PHP files under both tools as written. Switching to **/*.php would be redundant at best, and in some glob dialects **/*.php actually fails to match root-level .php files (no directory segment before the file) — which would be a real regression for a WordPress theme, where most template files (front-page.php, single.php, etc.) live at the theme root. Leaving as-is unless you have a specific counter-example of a nested file this pattern misses.


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

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer

- name: Get changed PHP files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: '**.php'
separator: ' '

- name: Install Composer dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: composer install --no-interaction --no-progress

- name: Run PHPCS on changed files
if: steps.changed-files.outputs.any_changed == 'true'
env:
PHP_FILES: ${{ steps.changed-files.outputs.added_files }} ${{ steps.changed-files.outputs.copied_files }} ${{ steps.changed-files.outputs.modified_files }} ${{ steps.changed-files.outputs.renamed_files }}
run: |
if [ -n "$(echo "$PHP_FILES" | xargs)" ]; then
composer phpcs -- $PHP_FILES
else
echo "No existing PHP files to lint (only deletions in this PR)."
fi
28 changes: 28 additions & 0 deletions .github/workflows/pr-build-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Testable ZIP

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [master]
workflow_dispatch:

jobs:
zip:
uses: themegrill/.github/.github/workflows/pr-build-zip.yml@master
with:
node-version: '20.x'
php-version: '7.4'
package-manager: npm
# package-lock.json isn't committed in this repo (.gitignore), so `npm ci`
# (the default install here) has nothing to install from.
install-command: npm install
composer-install: true
build-command: npm run build
zip-glob: 'dist/*.zip'
artifacts-bucket: themegrill-pr-artifacts
public-base-url: https://themegrill-pr-artifacts.s3.amazonaws.com
s3-region: us-east-1
secrets:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
ARTIFACTS_KEY: ${{ secrets.ARTIFACTS_KEY }}
ARTIFACTS_SECRET: ${{ secrets.ARTIFACTS_SECRET }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
omit=optional
16 changes: 14 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ module.exports = function( grunt ){
// Minify all .js files.
uglify: {
options: {
preserveComments: /(?:^!|@(?:license|preserve|cc_on))/
// Keep output ES5 for legacy-browser support.
compress: {
arrows: false
},
// `preserveComments` was removed in grunt-contrib-uglify 2.x+;
// this is the option UglifyJS itself understands.
output: {
comments: /(?:^!|@(?:license|preserve|cc_on))/
}
},
frontend: {
files: [{
Expand Down Expand Up @@ -91,6 +99,7 @@ module.exports = function( grunt ){
options: {
type: 'wp-theme',
domainPath: 'languages',
potComments: 'Copyright (C) {year} ThemeGrill\nThis file is distributed under the GNU General Public License, version 3 (GPLv3).',
potHeaders: {
'report-msgid-bugs-to': 'themegrill@gmail.com',
'language-team': 'ThemeGrill <themegrill@gmail.com'
Comment on lines +102 to 105

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 50a7868 — makepot's exclude list only had deploy/.; added inc/kirki/. alongside it. Regenerated the .pot: Kirki-related string count went from 217 matches to 0, confirmed with grep -ci kirki languages/flash.pot before/after.

Expand All @@ -100,7 +109,8 @@ module.exports = function( grunt ){
options: {
potFilename: 'flash.pot',
exclude: [
'deploy/.*' // Exclude deploy directory
'deploy/.*', // Exclude deploy directory
'inc/kirki/.*' // Exclude bundled third-party Kirki library
]
}
}
Expand Down Expand Up @@ -157,6 +167,8 @@ module.exports = function( grunt ){
'!node_modules/**',
'!sass/**',
'!phpcs.xml',
'!composer.json',
'!composer.lock',
'README.md'
],
dest: 'flash',
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"description": "Free responsive multipurpose WordPress theme from ThemeGrill",
"type": "project",
"require-dev": {
"squizlabs/php_codesniffer": "3.2",
"wp-coding-standards/wpcs": "0.14.0",
"wimg/php-compatibility": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2"
"squizlabs/php_codesniffer": "^3.9",
"wp-coding-standards/wpcs": "^3.1",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"license": "MIT",
"authors": [
Expand All @@ -19,5 +19,9 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"phpcs": "phpcs",
"phpcbf": "phpcbf"
}
}
Loading
Loading