This repository contains the default community health
files
for the alleyinteractive
organization.
This repository acts as a catch-all for Github organization-wide community files, such as CODE_OF_CONDUCT.md. These community health files will be used unless a repository has their own version.
The repository also contains reusable Github workflows for use on any public repository. These workflows are reused across the organization to perform continuous integration tests with Github Actions.
The following workflows are available to use:
Create a *-built
version of a branch for use in submodules.
Specify using
with
keyword.
php
8.1
.node
16
.name: Create a -built branch
on:
push:
branches:
- main
jobs:
built-branch:
uses: alleyinteractive/.github/.github/workflows/built-branch.yml@main
ℹ️ Note: This action is deprecated in favor of the action-release.
Create built releases of a project based on the WordPress plugin Version
header in your main plugin file and then falling back to the version
property in
either composer.json
or package.json
. When the version is updated in either
file, the action will build the project, push a new tag up with the version, and
create a release. Optionally, the release can be drafted or published.
The most common use of this workflow is for WordPress plugins or other packages that require built assets (such as ones from Webpack or Gulp) to be included to work but we don't want to include those assets in version control.
When the plugin's version is incremented on
alleyinteractive/create-wordpress-plugin
-based plugins via npm run release
,
the action will push a built version of the plugin to the *-built
branch and
then create a release with the built assets. If the plugin's version was not
incremented, the action will still push the latest changes to the *-built
branch but will not create a release. This does mirror the
Built Branch workflow but is more flexible and allows for
publishing releases.
Specify using
with
keyword.
draft
false
.node
18
.name: Built Release
on:
push:
branches:
- production
jobs:
built-asset:
uses: alleyinteractive/.github/.github/workflows/built-release.yml@main
ℹ️ Note: This action is deprecated in favor of the action-release. Built tags with the format of
v*.*.*-built
are not compatible with Composer and should be avoided.
Create a *-built
version of a tag for use in submodules.
Specify using
with
keyword.
php
8.1
.node
16
.name: Create a -built tag
on:
push:
tags:
- 'v*.*.*'
- '!*-built'
jobs:
built-tag:
uses: alleyinteractive/.github/.github/workflows/built-tag.yml@main
Sets Dependabot pull requests to auto merge once they meet the requirements for merging (passes CI, approval, etc. as defined by the protected branch).
name: dependabot-auto-merge
on:
pull_request:
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
uses: alleyinteractive/.github/.github/workflows/dependabot-auto-merge.yml@main
Automatically approves Dependabot pull requests for auto-merging when the default branch for a repository is protected.
name: dependabot-auto-approve
on:
pull_request:
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
uses: alleyinteractive/.github/.github/workflows/dependabot-auto-approve.yml@main
Run automated Node tests against your repository. Assumes that your plugin will have the following commands available to it:
npm run lint
npm run test
npm run build
Specify using
with
keyword.
node
16
.ci
npm ci
should be used versus npm install
.false
.cache
package-lock.json
is not found.true
.run-audit
npm audit --audit-level=high --production
should be run.false
.run-test
npm run test
should be run.true
.run-lint
npm run lint
should be run.true
.run-build
npm run build
should be run.true
.working-directory
name: Node Tests
on:
pull_request:
jobs:
node-tests:
uses: alleyinteractive/.github/.github/workflows/node-tests.yml@main
Run a set of Composer scripts against your project. Assumes that composer run <command>
will run your tests. Supports multiple commands with a multi-line
command
input.
Note: This workflow does not setup MySQL for testing. Use the PHP Tests with MySQL workflow for that.
Specify using
with
keyword.
command
php
8.1
.database
'mysql:8.0'
. Can be disabled by setting it to an empty string.working-directory
name: Composer Tests
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
composer-lint-phpunit:
uses: alleyinteractive/.github/.github/workflows/php-composer-command.yml@main
with:
command: |
lint
phpunit
Run PHPUnit tests against your project. Installs and configures MySQL for
WordPress unit testing. Assumes that composer run phpunit
will run your unit
tests.
Specify using
with
keyword.
action
install
.command
phpunit
.os
ubuntu-latest
.php
8.1
.wordpress
latest
.multisite
WP_MULTISITE
flag.false
.database
mysql:8.0
. Can be disabled by setting it to an empty string.object-cache
memcached
or redis
.dependency-versions
locked
, highest
, or lowest
.locked
.install-core-tests
false
working-directory
name: Testing Suite
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
php-tests:
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
You can also use the PHP tests inside a Github Action Matrix to test against multiple PHP/WordPress versions:
name: Testing Suite
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
php-tests:
strategy:
matrix:
php: [8.1]
wordpress: ["latest"]
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
with:
php: ${{ matrix.php }}
wordpress: ${{ matrix.wordpress }}
Uses rsync and git to deploy files/folders from a local GitHub action repository to a remote repository.
Notes:
Specify using
with
keyword.
os
ubuntu-latest
.remote_repo
remote_branch
base_directory
.
). NOTE You likely want a trailing slash if you're syncing a subdirectory. (eg. wp-content/
)destination_directory
.
).exclude_list
.git, .gitmodules
).git, .gitmodules
.Specify using
secrets
keyword.
REMOTE_REPO_SSH_KEY
Example deploy to VIP:
name: Deploy to VIP repository
on:
push:
branches:
- production
- preprod
- develop
jobs:
sync-to-vip:
uses: alleyinteractive/.github/.github/workflows/deploy-to-remote-repository.yml@main
with:
remote_repo: 'git@github.com:wpcomvip/alley.git'
exclude_list: '.git, .gitmodules, .revision, .deployment-state, .node_modules, no-vip'
secrets:
REMOTE_REPO_SSH_KEY: ${{ secrets.REMOTE_REPO_SSH_KEY }}
Example Deploy to Pantheon multidev sites labeled preprod
and develop
:
name: Deploy to Pantheon repository
on:
push:
branches:
- preprod
- develop
jobs:
sync-to-pantheon:
uses: alleyinteractive/.github/.github/workflows/deploy-to-remote-repository.yml@main
with:
remote_repo: 'ssh://codeserver.dev.SOME-PANTHEON-SITE_ID@codeserver.dev.SOME-PANTHEON-SITE_ID.drush.in:2222/~/repository.git'
destination_directory: 'wp-content/'
exclude_list: '.git, pantheon-mu-plugin'
secrets:
REMOTE_REPO_SSH_KEY: ${{ secrets.REMOTE_REPO_SSH_KEY }}
Run phpstan
tests against your project. Assumes that composer run phpstan
will
run your tests.
ℹ️ Note: This action is deprecated in favor of the PHP Composer Script workflow.
Specify using
with
keyword.
command
phpstan
.php
8.1
.dependency-versions
locked
, highest
, or lowest
.locked
.working-directory
name: Code Quality
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
code-quality:
uses: alleyinteractive/.github/.github/workflows/php-code-quality.yml@main
Run phpcs
tests against your project. Assumes that composer run phpcs
will
run your tests.
ℹ️ Note: This action is deprecated in favor of the PHP Composer Script action.
Specify using
with
keyword.
php
8.1
.dependency-versions
locked
, highest
, or lowest
.locked
.working-directory
name: Coding Standards
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
coding-standards:
uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main