{"id":44,"date":"2026-11-10T14:00:00","date_gmt":"2026-11-10T08:00:00","guid":{"rendered":"https:\/\/nazmulrobin.com\/blog\/?p=44"},"modified":"2026-11-10T18:33:39","modified_gmt":"2026-11-10T12:33:39","slug":"checks-on-every-pull-request","status":"publish","type":"post","link":"https:\/\/nazmulrobin.com\/blog\/checks-on-every-pull-request\/","title":{"rendered":"The checks that run on every pull request to this blog"},"content":{"rendered":"\n<p>Every change to this blog&#8217;s code goes through a pull request, and eight small checks run on it before I merge. This post lists each check, the part of the workflow that runs it, and what it has caught so far.<\/p>\n<p>This post is part of the series on how this blog is built. It builds on <a href=\"https:\/\/nazmulrobin.com\/blog\/laravel-and-wordpress-on-one-domain\/\">how the blog&#8217;s code is kept in git and deployed<\/a> and on <a href=\"https:\/\/nazmulrobin.com\/blog\/publish-wordpress-posts-from-markdown\/\">publishing posts from Markdown files<\/a>.<\/p>\n<h2>Why a one-person project needs them<\/h2>\n<p>I am the only one who writes this code, and the only one who reviews it. Nobody else will notice a deploy script that deletes the wrong folder, or a token pasted into a file.<\/p>\n<p>A push to the <code>production<\/code> branch goes straight to the live server. So the checks do the part of a review that a second person would do: read every line, every time, without getting tired.<\/p>\n<p>All of them live in one file, <code>.github\/workflows\/checks.yml<\/code>, which starts like this:<\/p>\n<pre><code class=\"language-yaml hljs\"><span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Checks<\/span>\n\n<span class=\"hljs-attr\">on:<\/span>\n  <span class=\"hljs-attr\">pull_request:<\/span>\n\n<span class=\"hljs-attr\">jobs:<\/span><\/code><\/pre>\n<p>Each section below is one check in that file. Most of them are steps of one job, <code>checks<\/code>, which runs on PHP 8.2; the end of the post says why they are not a job each.<\/p>\n<h2>PHP syntax, on three versions<\/h2>\n<p>The plugin says it needs PHP 7.4. The server ran 8.2 when I set this up, and runs 8.5 now. Every tracked PHP file is checked on all three: on 8.2 in the <code>checks<\/code> job, and on the other two in a small job of their own:<\/p>\n<pre><code class=\"language-yaml hljs\">  <span class=\"hljs-attr\">php:<\/span>\n    <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">PHP<\/span> <span class=\"hljs-string\">syntax<\/span> <span class=\"hljs-string\">and<\/span> <span class=\"hljs-string\">tests<\/span> <span class=\"hljs-string\">(${{<\/span> <span class=\"hljs-string\">matrix.php<\/span> <span class=\"hljs-string\">}})<\/span>\n    <span class=\"hljs-attr\">runs-on:<\/span> <span class=\"hljs-string\">ubuntu-latest<\/span>\n    <span class=\"hljs-attr\">strategy:<\/span>\n      <span class=\"hljs-attr\">matrix:<\/span>\n        <span class=\"hljs-attr\">php:<\/span> <span class=\"hljs-string\">[<\/span> <span class=\"hljs-string\">\"7.4\"<\/span><span class=\"hljs-string\">,<\/span> <span class=\"hljs-string\">\"8.5\"<\/span> <span class=\"hljs-string\">]<\/span>\n\n    <span class=\"hljs-attr\">steps:<\/span>\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">uses:<\/span> <span class=\"hljs-string\">actions\/checkout@v4<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">uses:<\/span> <span class=\"hljs-string\">shivammathur\/setup-php@v2<\/span>\n      <span class=\"hljs-attr\">with:<\/span>\n        <span class=\"hljs-attr\">php-version:<\/span> <span class=\"hljs-string\">${{<\/span> <span class=\"hljs-string\">matrix.php<\/span> <span class=\"hljs-string\">}}<\/span>\n        <span class=\"hljs-attr\">coverage:<\/span> <span class=\"hljs-string\">none<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Check<\/span> <span class=\"hljs-string\">every<\/span> <span class=\"hljs-string\">tracked<\/span> <span class=\"hljs-string\">PHP<\/span> <span class=\"hljs-string\">file<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">git<\/span> <span class=\"hljs-string\">ls-files<\/span> <span class=\"hljs-string\">'*.php'<\/span> <span class=\"hljs-string\">|<\/span> <span class=\"hljs-string\">xargs<\/span> <span class=\"hljs-string\">-n<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-string\">php<\/span> <span class=\"hljs-string\">-l<\/span><\/code><\/pre>\n<p><code>git ls-files<\/code> lists only what is in the repo, so the plugins Composer installs are not checked. They are not my code.<\/p>\n<h2>WordPress coding standards<\/h2>\n<p>PHPCS with the <code>WordPress<\/code> standard reads the plugin, the theme and the must-use plugins. Besides code style, that standard has the rules I care about most: output is escaped, input is sanitized, and a form handler checks its nonce.<\/p>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Install<\/span> <span class=\"hljs-string\">PHPCS<\/span> <span class=\"hljs-string\">with<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">WordPress<\/span> <span class=\"hljs-string\">standard<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">|\n        composer global config allow-plugins.dealerdirect\/phpcodesniffer-composer-installer true\n        composer global require --no-interaction wp-coding-standards\/wpcs:^3.1\n<\/span>\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Run<\/span> <span class=\"hljs-string\">PHPCS<\/span> <span class=\"hljs-string\">with<\/span> <span class=\"hljs-string\">phpcs.xml.dist<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">phpcs<\/span><\/code><\/pre>\n<p>The settings are in <code>phpcs.xml.dist<\/code> at the repo root. It names the folders, the text domain and the prefix every global name has to start with:<\/p>\n<pre><code class=\"language-xml hljs\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">config<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"minimum_wp_version\"<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"6.7\"<\/span>\/&gt;<\/span>\n<span class=\"hljs-comment\">&lt;!-- Warnings are reported but only errors fail the check. --&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">config<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"ignore_warnings_on_exit\"<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"1\"<\/span>\/&gt;<\/span>\n\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">rule<\/span> <span class=\"hljs-attr\">ref<\/span>=<span class=\"hljs-string\">\"WordPress.WP.I18n\"<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">property<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"text_domain\"<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"array\"<\/span>&gt;<\/span>\n            <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">element<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"myblog\"<\/span>\/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">property<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">rule<\/span>&gt;<\/span>\n\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">rule<\/span> <span class=\"hljs-attr\">ref<\/span>=<span class=\"hljs-string\">\"WordPress.NamingConventions.PrefixAllGlobals\"<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">property<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"prefixes\"<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"array\"<\/span>&gt;<\/span>\n            <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">element<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"myblog\"<\/span>\/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">property<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">rule<\/span>&gt;<\/span><\/code><\/pre>\n<p>One false positive needed its own setting. My LinkedIn form handlers did not call <code>check_admin_referer()<\/code> themselves. They called one helper that checks the nonce and the user&#8217;s capability together:<\/p>\n<pre><code class=\"language-php hljs\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">myblog_linkedin_check_admin<\/span><span class=\"hljs-params\">( $action )<\/span> <\/span>{\n    check_admin_referer( $action );\n\n    <span class=\"hljs-keyword\">if<\/span> ( ! current_user_can( <span class=\"hljs-string\">'manage_options'<\/span> ) ) {\n        wp_die( esc_html__( <span class=\"hljs-string\">'You are not allowed to manage the LinkedIn connection.'<\/span>, <span class=\"hljs-string\">'myblog'<\/span> ), <span class=\"hljs-number\">403<\/span> );\n    }\n}<\/code><\/pre>\n<p>PHPCS does not look inside the helper, so it reported every handler as reading <code>$_POST<\/code> without a nonce check. The rule has a property for exactly this:<\/p>\n<pre><code class=\"language-xml hljs\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">rule<\/span> <span class=\"hljs-attr\">ref<\/span>=<span class=\"hljs-string\">\"WordPress.Security.NonceVerification\"<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">property<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"customNonceVerificationFunctions\"<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"array\"<\/span>&gt;<\/span>\n            <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">element<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"myblog_linkedin_check_admin\"<\/span>\/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">property<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">properties<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">rule<\/span>&gt;<\/span><\/code><\/pre>\n<p>That is better than a <code>phpcs:ignore<\/code> comment on every handler. A new handler that forgets the helper is still reported.<\/p>\n<h2>Tests<\/h2>\n<p>The site plugin has PHPUnit tests for the parts where a mistake is easy to make and hard to see: the Markdown parser, the reactions endpoint, the views route and the &#8220;reading now&#8221; count. There are 63 so far. They run with <a href=\"https:\/\/github.com\/10up\/wp_mock\">WP_Mock<\/a>, which stands in for WordPress&#8217;s functions, so no database or WordPress install is needed. Like the syntax check, they run on all three PHP versions, as two more steps of the same jobs:<\/p>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-comment\"># PHPUnit has its own composer.json in tests\/, apart from the packages that are deployed.<\/span>\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Install<\/span> <span class=\"hljs-string\">PHPUnit<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">composer<\/span> <span class=\"hljs-string\">install<\/span> <span class=\"hljs-string\">--working-dir=tests<\/span> <span class=\"hljs-string\">--no-interaction<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Run<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">tests<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">composer<\/span> <span class=\"hljs-string\">test<\/span> <span class=\"hljs-string\">--working-dir=tests<\/span><\/code><\/pre>\n<p>PHPUnit has its own <code>composer.json<\/code> in <code>tests\/<\/code> for the same reason as PHPCS below: the root vendor folder is copied to the live site.<\/p>\n<h2>Composer packages<\/h2>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Validate<\/span> <span class=\"hljs-string\">composer.json<\/span> <span class=\"hljs-string\">and<\/span> <span class=\"hljs-string\">composer.lock<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">composer<\/span> <span class=\"hljs-string\">validate<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Look<\/span> <span class=\"hljs-string\">for<\/span> <span class=\"hljs-string\">known<\/span> <span class=\"hljs-string\">vulnerabilities<\/span> <span class=\"hljs-string\">in<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">locked<\/span> <span class=\"hljs-string\">packages<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">composer<\/span> <span class=\"hljs-string\">audit<\/span> <span class=\"hljs-string\">--locked<\/span><\/code><\/pre>\n<p><code>composer validate<\/code> fails when <code>composer.json<\/code> was edited and the lock file was not updated with it. <code>composer audit<\/code> compares the locked packages with the published security advisories.<\/p>\n<h2>The scripts and the workflows<\/h2>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Check<\/span> <span class=\"hljs-string\">JavaScript<\/span> <span class=\"hljs-string\">syntax<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">git<\/span> <span class=\"hljs-string\">ls-files<\/span> <span class=\"hljs-string\">'*.js'<\/span> <span class=\"hljs-string\">':!:*\/admin\/*'<\/span> <span class=\"hljs-string\">|<\/span> <span class=\"hljs-string\">xargs<\/span> <span class=\"hljs-string\">-n<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-string\">node<\/span> <span class=\"hljs-string\">--check<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Check<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">deploy<\/span> <span class=\"hljs-string\">and<\/span> <span class=\"hljs-string\">staging<\/span> <span class=\"hljs-string\">scripts<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">shellcheck<\/span> <span class=\"hljs-string\">deploy.sh<\/span> <span class=\"hljs-string\">staging.sh<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Check<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">workflows<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">|\n        bash &lt;(curl -fsSL https:\/\/raw.githubusercontent.com\/rhysd\/actionlint\/main\/scripts\/download-actionlint.bash)\n        .\/actionlint -color<\/span><\/code><\/pre>\n<p><code>shellcheck<\/code> failed on its first run, on this line of the deploy script:<\/p>\n<pre><code class=\"language-sh hljs\">rm -rf <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$WP_PATH<\/span>\/<span class=\"hljs-variable\">$dir<\/span>\"<\/span><\/code><\/pre>\n<p>If <code>WP_PATH<\/code> were ever empty, that line would delete <code>\/wp-content\/plugins\/...<\/code> from the root of the server. The fix it asked for is three characters:<\/p>\n<pre><code class=\"language-sh hljs\">rm -rf <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${WP_PATH:?}<\/span>\/<span class=\"hljs-variable\">$dir<\/span>\"<\/span><\/code><\/pre>\n<p>With <code>:?<\/code> the shell stops with an error when the variable is empty or not set, and deletes nothing. The script had worked on every deploy until then. The check found a problem that only shows on the day something else goes wrong.<\/p>\n<p><code>actionlint<\/code> reads the workflow files themselves. A typo in a key name there is otherwise only found when the workflow runs, and for a deploy that is the wrong moment.<\/p>\n<h2>The admin app&#8217;s build<\/h2>\n<p>One wp-admin screen of the site plugin is a React app. The server has no Node, so the built files are committed. This check makes sure they belong to the source next to them:<\/p>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">The<\/span> <span class=\"hljs-string\">committed<\/span> <span class=\"hljs-string\">build<\/span> <span class=\"hljs-string\">matches<\/span> <span class=\"hljs-string\">the<\/span> <span class=\"hljs-string\">source<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">|\n        npm run build\n        if [ -n \"$(git status --porcelain admin\/build)\" ]; then\n          echo \"::error::admin\/build is out of date. Run npm run build and commit the result.\"\n          git status --short admin\/build\n          exit 1\n        fi<\/span><\/code><\/pre>\n<p>It builds the app again and fails if git sees any difference. A step before it runs ESLint on the source.<\/p>\n<h2>A scan for secrets<\/h2>\n<p>The scan is a step of the <code>checks<\/code> job, so that job&#8217;s header carries what the scan needs:<\/p>\n<pre><code class=\"language-yaml hljs\">  <span class=\"hljs-attr\">checks:<\/span>\n    <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Checks<\/span> <span class=\"hljs-string\">(8.2)<\/span>\n    <span class=\"hljs-attr\">runs-on:<\/span> <span class=\"hljs-string\">ubuntu-latest<\/span>\n    <span class=\"hljs-comment\"># gitleaks reads the pull request's list of commits.<\/span>\n    <span class=\"hljs-attr\">permissions:<\/span>\n      <span class=\"hljs-attr\">contents:<\/span> <span class=\"hljs-string\">read<\/span>\n      <span class=\"hljs-attr\">pull-requests:<\/span> <span class=\"hljs-string\">read<\/span>\n\n    <span class=\"hljs-attr\">steps:<\/span>\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">uses:<\/span> <span class=\"hljs-string\">actions\/checkout@v4<\/span>\n      <span class=\"hljs-attr\">with:<\/span>\n        <span class=\"hljs-attr\">fetch-depth:<\/span> <span class=\"hljs-number\">0<\/span>\n\n    <span class=\"hljs-comment\"># ... the other checks ...<\/span>\n\n    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">uses:<\/span> <span class=\"hljs-string\">gitleaks\/gitleaks-action@v2<\/span>\n      <span class=\"hljs-attr\">env:<\/span>\n        <span class=\"hljs-attr\">GITHUB_TOKEN:<\/span> <span class=\"hljs-string\">${{<\/span> <span class=\"hljs-string\">github.token<\/span> <span class=\"hljs-string\">}}<\/span><\/code><\/pre>\n<p>gitleaks looks through the branch&#8217;s commits for things shaped like keys and tokens. <code>fetch-depth: 0<\/code> gives it the full history; the default checkout has one commit.<\/p>\n<p>This check also failed on its first run, and not because of a secret. On my private repo the workflow&#8217;s token could not read the pull request, and gitleaks needs the pull request&#8217;s list of commits. The <code>permissions<\/code> block fixed it.<\/p>\n<h2>A new version and a changelog entry<\/h2>\n<p>Every deploy of this blog is a numbered release. The last check makes sure a pull request that changes deployed code also raises the version and says what changed:<\/p>\n<pre><code class=\"language-yaml hljs\">    <span class=\"hljs-bullet\">-<\/span> <span class=\"hljs-attr\">name:<\/span> <span class=\"hljs-string\">Deployed<\/span> <span class=\"hljs-string\">code<\/span> <span class=\"hljs-string\">needs<\/span> <span class=\"hljs-string\">a<\/span> <span class=\"hljs-string\">new<\/span> <span class=\"hljs-string\">version<\/span> <span class=\"hljs-string\">and<\/span> <span class=\"hljs-string\">a<\/span> <span class=\"hljs-string\">changelog<\/span> <span class=\"hljs-string\">section<\/span>\n      <span class=\"hljs-attr\">env:<\/span>\n        <span class=\"hljs-attr\">BASE:<\/span> <span class=\"hljs-string\">origin\/${{<\/span> <span class=\"hljs-string\">github.base_ref<\/span> <span class=\"hljs-string\">}}<\/span>\n      <span class=\"hljs-attr\">run:<\/span> <span class=\"hljs-string\">|\n        plugin=wp-content\/plugins\/myblog\/myblog.php\n<\/span>\n        <span class=\"hljs-string\">if<\/span> <span class=\"hljs-string\">git<\/span> <span class=\"hljs-string\">diff<\/span> <span class=\"hljs-string\">--quiet<\/span> <span class=\"hljs-string\">\"$BASE...HEAD\"<\/span> <span class=\"hljs-string\">--<\/span> <span class=\"hljs-string\">wp-content<\/span> <span class=\"hljs-string\">composer.json<\/span> <span class=\"hljs-string\">composer.lock<\/span> <span class=\"hljs-string\">deploy.sh<\/span> <span class=\"hljs-string\">staging.sh;<\/span> <span class=\"hljs-string\">then<\/span>\n          <span class=\"hljs-string\">echo<\/span> <span class=\"hljs-string\">\"No deployed code changed.\"<\/span>\n          <span class=\"hljs-string\">exit<\/span> <span class=\"hljs-number\">0<\/span>\n        <span class=\"hljs-string\">fi<\/span>\n\n        <span class=\"hljs-string\">version=$(sed<\/span> <span class=\"hljs-string\">-n<\/span> <span class=\"hljs-string\">'s\/^ \\* Version: *\/\/p'<\/span> <span class=\"hljs-string\">\"$plugin\"<\/span><span class=\"hljs-string\">)<\/span>\n        <span class=\"hljs-string\">before=$(git<\/span> <span class=\"hljs-string\">show<\/span> <span class=\"hljs-string\">\"$BASE:$plugin\"<\/span> <span class=\"hljs-string\">|<\/span> <span class=\"hljs-string\">sed<\/span> <span class=\"hljs-string\">-n<\/span> <span class=\"hljs-string\">'s\/^ \\* Version: *\/\/p'<\/span><span class=\"hljs-string\">)<\/span>\n\n        <span class=\"hljs-string\">if<\/span> <span class=\"hljs-string\">[<\/span> <span class=\"hljs-string\">\"$version\"<\/span> <span class=\"hljs-string\">=<\/span> <span class=\"hljs-string\">\"$before\"<\/span> <span class=\"hljs-string\">];<\/span> <span class=\"hljs-string\">then<\/span>\n          <span class=\"hljs-string\">echo<\/span> <span class=\"hljs-string\">\"::error file=$plugin::Deployed code changed but Version is still $version.\"<\/span>\n          <span class=\"hljs-string\">exit<\/span> <span class=\"hljs-number\">1<\/span>\n        <span class=\"hljs-string\">fi<\/span>\n\n        <span class=\"hljs-string\">if<\/span> <span class=\"hljs-string\">!<\/span> <span class=\"hljs-string\">grep<\/span> <span class=\"hljs-string\">-q<\/span> <span class=\"hljs-string\">\"^## $version \"<\/span> <span class=\"hljs-string\">CHANGELOG.md;<\/span> <span class=\"hljs-string\">then<\/span>\n          <span class=\"hljs-string\">echo<\/span> <span class=\"hljs-string\">\"::error file=CHANGELOG.md::CHANGELOG.md has no section for $version.\"<\/span>\n          <span class=\"hljs-string\">exit<\/span> <span class=\"hljs-number\">1<\/span>\n        <span class=\"hljs-string\">fi<\/span><\/code><\/pre>\n<p>A pull request that only edits the README passes without a new version. One that touches anything the deploy copies does not.<\/p>\n<p>After a deploy, the deploy workflow reads the same version, creates the git tag <code>v1.2.3<\/code> and a GitHub release, and uses that version&#8217;s changelog section as the release notes. So the check on the pull request is what keeps the list of releases complete.<\/p>\n<h2>The posts have their own check<\/h2>\n<p>The posts are in a second repo, and a pull request there runs one Ruby script. It checks each file&#8217;s name, that the front matter is valid YAML with a title, a date and an excerpt, that the category is on the allowed list, and that a link to another post points at a post that exists.<\/p>\n<p>The front matter check is there because of one title. It had a colon followed by a space in it and no quotes:<\/p>\n<pre><code class=\"language-yaml hljs\"><span class=\"hljs-attr\">title: Claude Code tip:<\/span> <span class=\"hljs-string\">two<\/span> <span class=\"hljs-string\">accounts<\/span> <span class=\"hljs-string\">on<\/span> <span class=\"hljs-string\">one<\/span> <span class=\"hljs-string\">machine<\/span><\/code><\/pre>\n<p>My own sync reads each line with a regular expression and was happy with it. GitHub reads the block as YAML, could not parse it, and showed an error where the file&#8217;s preview should be. The script now parses the block the way GitHub does:<\/p>\n<pre><code class=\"language-ruby hljs\"><span class=\"hljs-keyword\">begin<\/span>\n  meta = YAML.safe_load(front, <span class=\"hljs-symbol\">permitted_classes:<\/span> [Date, Time])\n<span class=\"hljs-keyword\">rescue<\/span> Psych::Exception =&gt; e\n  fail_with.call(<span class=\"hljs-string\">\"the front matter is not valid YAML (<span class=\"hljs-subst\">#{e.message.lines.first.strip}<\/span>). Put a value containing a colon and a space in double quotes.\"<\/span>)\n  <span class=\"hljs-keyword\">next<\/span>\n<span class=\"hljs-keyword\">end<\/span><\/code><\/pre>\n<h2>Things that caught me<\/h2>\n<ul>\n<li><strong>PHPCS cannot go into <code>composer.json<\/code> here.<\/strong> Composer&#8217;s vendor folder in this repo is copied to the live site with the plugin. So the workflow installs PHPCS globally, and locally I use any PHPCS that has the <code>WordPress<\/code> standard.<\/li>\n<li><strong>File names clash with the standard.<\/strong> The standard wants <code>class-my-thing.php<\/code>. My classes are loaded by Composer&#8217;s PSR-4 autoloader, which wants <code>MyThing.php<\/code>. Those two file name rules are excluded in <code>phpcs.xml.dist<\/code>, with a comment saying why.<\/li>\n<li><strong>Warnings do not fail the check.<\/strong> Only errors do. Otherwise one warning I disagree with would teach me to ignore a red check.<\/li>\n<li><strong>Each job costs at least a minute.<\/strong> GitHub bills a private repo&#8217;s Actions by the minute, rounded up for each job, and the free plan has 2,000 minutes a month. At first every check was a job of its own, twelve with the PHP versions, and each one took seconds but counted as a minute. That used most of a month&#8217;s minutes in October. Now the checks are steps of three jobs, and a pull request that only changes Markdown or <code>docs\/<\/code> skips them. The cost of that: a failed step stops its job, so a check after it shows its result on the next push.<\/li>\n<li><strong>A red check does not stop a merge.<\/strong> Branch protection on a private repo needs a paid GitHub plan. For now the rule is mine to keep: no merge while a check is red.<\/li>\n<\/ul>\n<h2>Next to the checks<\/h2>\n<p>Two more workflows run outside this file. Lighthouse measures the staging copy after each deploy to it, the home page and the newest post, and prints the scores. And Claude reviews each pull request that changes code and writes what it finds as comments. Neither blocks a merge; both are second opinions.<\/p>\n<p>Eight checks, one workflow file, and two of them failed on their first run for good reasons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog has one author and one reviewer, and they are the same person. Eight small GitHub Actions checks read every pull request before I merge it. Here is each one, its workflow snippet and what it has caught.<\/p>\n","protected":false},"author":1,"featured_media":179,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_nhrrob_social_share_linkedin_text":"This blog has one author and one reviewer, and they are the same person.\n\nSo eight small GitHub Actions checks read every pull request before I merge it: PHP syntax on three versions, coding standards, tests, a secret scan, a version and changelog check, and more.\n\nThe post has each check, its workflow snippet and what it has caught.\n\nWhat is the one check you would never merge without?","_nhrrob_social_share_linkedin_layout":"","_nhrrob_social_share_x_text":"","_nhrrob_social_share_reddit":[],"_nhrrob_social_share_pro_texts":[],"_nhrrob_social_share_pro_x_texts":[],"footnotes":""},"categories":[7],"tags":[8,11,13],"class_list":["post-44","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-building-this-blog","tag-deployment","tag-github-actions"],"_links":{"self":[{"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":3,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions\/116"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/media\/179"}],"wp:attachment":[{"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nazmulrobin.com\/blog\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}