Skip to content

Allow commit message and revision to be passed through an environment variable #136

Open

Description

@desrosj

WordPress Core currently runs PHPUnit tests in two steps.

The first step checks out the WordPress repo, installs NPM, builds WP for use, and then zips everything to upload as an artifact on the workflow run. After that, individual jobs are created for various PHP/Memcached combinations to run the PHPUnit tests by downloading the previously built artifact. This prevents every job from needing to perform these steps.

However, the .git folder is not packaged and included in the artifact to save space (and it's no longer needed anyway).

When the test reporter submits results, it scans for .git and .svn directories to grab the commit message and revision number to associate the results with. In order for this to work successfully, the Git repo needs to be reconnected to the codebase (see Core revision 49786).

The GitHub Action runner provides this information through the github workflow context. In the case of a push trigger event, the context would be github.event.head_commit.message (see https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#push).

If the runner first checked for environment variables and fell back to searching for those directories as a second option, that information could be passed to the reporter without having to reestablish the directory as a Git repository.

Activity

  1. getsource commented on Dec 11, 2020

    @getsource
    Member

    Thanks for the report!

    Using environment variables to work around this makes sense to me.

  2. moved this from In progress to Ready in Hosting Team WCUS 2026on Aug 12, 2026
  3. ekamran commented on Sep 29, 2026

    @ekamran
    Contributor

    I checked whether this still applies, since the report is from the artifact-based workflow core used in 2020.

    Core removed that artifact hand-off in 4ab922d224 (February 2021): each PHPUnit job checks out the repository directly, and today's reusable workflow still does (it even runs git diff --exit-code right before the report step, so .git is present in the workspace the container mounts at /var/www). The PHP images used by core's Docker environment ship git, and the GitHub mirror commits carry the git-svn-id: line that report.php reads.

    The current behavior confirms it. In core's trunk run from 2026-09-14, the "PHP 8.5 / MySQL 8.4 (test reporting enabled)" job logged "Getting SVN Revision", "Getting SVN message", and then uploaded https://make.wordpress.org/hosting/test-results/r63618/wpdevbot-r63618-8-5-unknown/. The reporter stores the submitted message as the revision post title, and that report shows the expected commit subject, so both the revision and the message reach the reporter without any environment variable. The documented runner path (prepare.php always clones) and the current core CI path both have a git checkout available when report.php runs.

    I think this can be closed as resolved by the core workflow change. If a host runs the reporter against a git-less tree, an environment override with the git lookup as fallback would still be a small change, so shout if that setup exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions