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
80 changes: 80 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This file configures the 'actions/labeler' GitHub Action.
# It maps labels to file paths. When a pull request modifies a file
# matching a path, the corresponding label is automatically applied.
#
# For more information, see: https://github.com/actions/labeler

# Documentation
lang:md:
- '**/*.md'
- 'docs/**/*'
- 'docs/**/*.md'

# Dependencies
area:dependencies:
- 'composer.json'
- 'composer.lock'
- 'package.json'
- 'package-lock.json'

# CI / Build configuration
area:ci:
- 'webpack.config.js'
- 'package.json'
- '.github/workflows/*'
- 'tests/**/*'
- '**/*_test.php'
- '**/*Test.php'
- '.editorconfig'
- '.eslintrc.js'
- 'phpcs.xml'
- changed-files:
any-glob-to-any-file:
- '.github/workflows/**'

# JavaScript sources
lang:javascript:
- 'src/js/**/*.js'
- 'assets/js/**/*.js'
- 'src/blocks/**/*.js'
- changed-files:
any-glob-to-any-file:
- '**/*.{js,jsx,ts,tsx}'

# CSS / SASS sources
lang:css:
- 'src/css/**/*.scss'
- 'src/css/**/*.css'
- 'assets/css/**/*.css'
- 'src/blocks/**/*.scss'
- changed-files:
any-glob-to-any-file:
- '**/*.{css,scss}'

# PHP sources
lang:php:
- '**/*.php'
- changed-files:
any-glob-to-any-file:
- '**/*.php'

# Block editor / patterns
area:block-editor:
- 'src/blocks/**/*'
- changed-files:
- any-glob-to-any-file: ['**/block.json', '**/src/blocks/**']

area:theme:
- changed-files:
- any-glob-to-any-file: ['**/theme.json', '**/templates/**', '**/patterns/**', '**/parts/**']

# Integration-specific changes
area:integration:
- 'includes/integrations/**/*.php'
- 'integrations/**/*.php'

# Head branch → status hints (works on PRs)
"status:needs-review":
- head-branch: ['^feat/.*', '^fix/.*', '^docs?/.*', '^(chore|build)/.*']

# (changed-files mappings folded into the original label mappings above)
28 changes: 28 additions & 0 deletions .github/workflows/assign-issue-type.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Assign default Issue Type when missing

on:
issues:
types: [opened, reopened]

jobs:
default-type:
runs-on: ubuntu-latest
steps:
- name: Install GitHub CLI
uses: cli/cli-action@v2
- name: Obtain app token
id: app
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.LS_APP_ID || vars.LS_APP_ID }}
private_key: ${{ secrets.LS_APP_PRIVATE_KEY || vars.LS_APP_PRIVATE_KEY }}
- name: Set default Issue Type
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
LS_PROJECT_URL: ${{ secrets.LS_PROJECT_URL || vars.LS_PROJECT_URL }}
run: |
NUMBER=${{ github.event.issue.number }}
NODE_ID=${{ github.event.issue.node_id }}
# Determine if the Project item has Issue Type set (requires GraphQL)
# Replace ISSUE_TYPE_FIELD_ID and DEFAULT_TYPE_OPTION_ID with your project field IDs.
echo "Placeholder: use gh api to check and set Issue Type field to 'Task' when missing."
39 changes: 39 additions & 0 deletions .github/workflows/changelog-release-product.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Generate changelog and draft release (Product)

on:
push:
branches:
- main
workflow_dispatch:

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

- name: Run Release Drafter
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter-product.yml

changelog-file:
runs-on: ubuntu-latest
needs: draft-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update CHANGELOG.md
uses: mikeal/changelog-maker@v2
with:
project-url: ${{ github.repository }}
- name: Commit and push changelog
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
if [[ `git status --porcelain` ]]; then
git add CHANGELOG.md
git commit -m "chore(changelog): update for latest release"
git push
fi
87 changes: 15 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,44 @@ name: CI

on:
push:
branches: [ main, develop ]
branches: [ main, master ]
pull_request:
branches: [ main, develop ]
branches: [ main, master ]

jobs:
lint:
name: Lint
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint
- name: Lint JS
run: npm run lint:js

test:
name: Test
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci
- name: Lint CSS
run: npm run lint:css

- name: Run tests
run: npm test

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build plugin
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-files
path: build/

package:
name: Create Plugin ZIP
runs-on: ubuntu-latest
needs: [lint, test, build]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build plugin
- name: Build
run: npm run build

- name: Create plugin ZIP
- name: Plugin zip
run: npm run plugin-zip

- name: Upload plugin ZIP
- name: Upload plugin artifact
uses: actions/upload-artifact@v4
with:
name: plugin-zip
path: copyright-date-block.zip
path: '*.zip'
if-no-files-found: error
39 changes: 39 additions & 0 deletions .github/workflows/labeler-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Default labeler rules for WordPress plugin repositories (multi‑block or extensions)
#
# These rules assign labels based on file paths and languages to aid triage and
# release notes. Labels must match the org‑wide conventions (lower‑case
# kebab‑case) and correspond to the `area:*` and `lang:*` families.

area:
block-editor:
- 'src/blocks/**'
- '**/block.json'
theme:
- 'templates/**'
- 'patterns/**'
backend:
- 'includes/**'
- 'classes/**'
- 'lib/**'
ci:
- '.github/workflows/**'
- 'composer.json'
- 'package.json'
- 'webpack.config.js'
dependencies:
- 'composer.lock'
- 'package-lock.json'

lang:
php:
- '**/*.php'
javascript:
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
css:
- '**/*.css'
- '**/*.scss'
md:
- '**/*.md'
83 changes: 83 additions & 0 deletions .github/workflows/labels-issues-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Labels for issues and pull requests

# This workflow applies default lifecycle and priority labels to issues,
# enforces exactly one status:* label, and runs path‑based labelling for PRs
# using labeler.yml. It also adds a changelog reminder on PRs.

on:
issues:
types: [opened, reopened, transferred]
pull_request:
types: [opened, reopened, synchronize]

jobs:
label:
runs-on: ubuntu-latest
steps:
# Apply path‑based labels for PRs via .github/labeler.yml
- name: Run PR labeler
if: github.event_name == 'pull_request'
uses: actions/labeler@v4
with:
configuration-path: .github/labeler.yml
sync-labels: true

# Default labels and enforcement for issues
- name: Set default issue labels
if: github.event_name == 'issues'
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue;
const labels = issue.labels.map(l => l.name);
const toAdd = [];
// Ensure exactly one status:* label
const statusLabels = labels.filter(l => l.startsWith('status:'));
if (statusLabels.length === 0) {
toAdd.push('status:needs-triage');
} else if (statusLabels.length > 1) {
core.setFailed(`Multiple status:* labels detected: ${statusLabels.join(', ')}`);
}
// Ensure at least one priority label
if (!labels.some(l => l.startsWith('priority:'))) {
toAdd.push('priority:normal');
}
// Apply labels if needed
if (toAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: toAdd,
});
}

# Default labels for PRs and changelog reminder
- name: Set default PR labels and changelog marker
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const labels = pr.labels.map(l => l.name);
const toAdd = [];
// Ensure exactly one status:* label on PRs
const statusLabels = labels.filter(l => l.startsWith('status:'));
if (statusLabels.length === 0) {
toAdd.push('status:needs-review');
} else if (statusLabels.length > 1) {
core.setFailed(`Multiple status:* labels detected: ${statusLabels.join(', ')}`);
}
// Add changelog marker if no changelog status is present
const hasChangelog = labels.some(l => l === 'meta:needs-changelog' || l === 'meta:no-changelog');
if (!hasChangelog) {
toAdd.push('meta:needs-changelog');
}
if (toAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: toAdd,
});
}
Loading