Make WordPress Core

Changeset 57758

Timestamp:
03/04/2024 11:23:59 AM (5 months ago)
Author:
desrosj
Message:

Build/Test Tools: Fix the precommit:emoji script.

GitHub recently sunset support for Subversion, causing the precommit:emoji Grunt script to break. Since there’s no direct replacement for svn ls in Git, this has been replaced with a query through the GitHub CLI.

This also adds a step in the workflow that tests the build process to run the precommit:emoji script to ensure no changes to built files are missed when updating the Twemoji library in the future.

Follow up to [57626].

Props kraftbj, peterwilsoncc, swissspidy.
Fixes #60520. See #57600.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/callable-test-core-build-process.yml

    r57655 r57758  
    6363        run: npm ci
    6464
     65
     66
     67
     68
     69
    6570      - name: Build WordPress to run from ${{ inputs.directory }}
    6671        run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }}
  • trunk/Gruntfile.js

    r57602 r57758  
    10481048                            match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
    10491049                            replacement: function() {
    1050                                 var regex, files,
     1050                                var regex, files,
    10511051                                    partials, partialsSet,
    1052                                     entities, emojiArray;
     1052                                    entities, emojiArray,
     1053                                    apiResponse, query;
    10531054
    10541055                                grunt.log.writeln( 'Fetching list of Twemoji files...' );
    10551056
     1057
     1058
     1059
     1060
     1061
     1062
    10561063                                // Fetch a list of the files that Twemoji supplies.
    1057                                 files = spawn( 'svn', [ 'ls', 'https://github.com/twitter/twemoji.git/trunk/assets/svg' ] );
     1064                                query = 'query={repository(owner: "jdecked", name: "twemoji") {object(expression: "v15.0.3:assets/svg") {... on Tree {entries {name}}}}}';
     1065                                files = spawn( 'gh', [ 'api', 'graphql', '-f', query] );
     1066
    10581067                                if ( 0 !== files.status ) {
    10591068                                    grunt.fatal( 'Unable to fetch Twemoji file list' );
    10601069                                }
    10611070
    1062                                 entities = files.stdout.toString();
     1071                                try {
     1072                                    apiResponse = JSON.parse( files.stdout.toString() );
     1073                                } catch ( e ) {
     1074                                    grunt.fatal( 'Unable to parse Twemoji file list' );
     1075                                }
     1076                                entities = apiResponse.data.repository.object.entries;
     1077                                entities = entities.reduce( function( accumulator, val ) { return accumulator + val.name + '\n'; }, '' );
    10631078
    10641079                                // Tidy up the file list.
Note: See TracChangeset for help on using the changeset viewer.