Skip to content

Commit 2ae1f86

Browse files
committed
Add commands for switching from local to remote trunk references for the workflow files (and back again).
1 parent aaec4df commit 2ae1f86

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Gruntfile.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,28 @@ module.exports = function(grunt) {
456456
} );
457457
}
458458
}
459+
},
460+
'workflow-references-local-to-remote': {
461+
options: {
462+
processContent: function( src ) {
463+
return src.replace( /uses: \.\/\.github\/workflows\/([^\.]+)\.yml/g, function( match, $1, $2, $3 ) {
464+
return 'uses: WordPress/wordpress-develop/.github/workflows/' + $1 + '.yml@trunk';
465+
} );
466+
}
467+
},
468+
src: '.github/workflows/*.yml',
469+
dest: './'
470+
},
471+
'workflow-references-remote-to-local': {
472+
options: {
473+
processContent: function( src ) {
474+
return src.replace( /uses: WordPress\/wordpress-develop\/\.github\/workflows\/([^\.]+)\.yml@trunk/g, function( match, $1, $2, $3 ) {
475+
return 'uses: ./.github/workflows/' + $1 + '.yml';
476+
} );
477+
}
478+
},
479+
src: '.github/workflows/*.yml',
480+
dest: './'
459481
}
460482
},
461483
sass: {
@@ -1513,6 +1535,14 @@ module.exports = function(grunt) {
15131535
'copy:version',
15141536
] );
15151537

1538+
grunt.registerTask( 'replace:workflow-references-local-to-remote', [
1539+
'copy:workflow-references-local-to-remote',
1540+
]);
1541+
1542+
grunt.registerTask( 'replace:workflow-references-remote-to-local', [
1543+
'copy:workflow-references-remote-to-local',
1544+
]);
1545+
15161546
/**
15171547
* Build verification tasks.
15181548
*/

0 commit comments

Comments
 (0)