Moved the contributors script from Grunt to bash.

This commit is contained in:
Peter Fabian 2020-05-11 11:00:42 +02:00
parent 4480637015
commit 80eb5ae931
2 changed files with 32 additions and 56 deletions

View File

@ -213,56 +213,6 @@ module.exports = function( grunt ) {
e2e_tests_grep: {
command: 'npm run --silent test:grep "' + grunt.option( 'grep' ) + '"'
},
contributors: {
command: [
'echo "<h2>WooCommerce core</h2>" > contributors.html',
'echo "Generating contributor list for WC core since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce --fromDate <%= fromDate %>' +
' --authToken <%= authToken %> --cols 6 --sortBy contributions --format html --sortOrder desc' +
' --showlogin true --filter "renovate-bot,apps/renovate,renovate,renovate[bot]" >> contributors.html',
'echo "Output generated to contributors.html."',
'echo "<h2>WooCommerce Admin</h2>" >> contributors.html',
'echo "Generating contributor list for WC Admin since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce-admin --fromDate <%= fromDate %>' +
' --authToken <%= authToken %> --cols 6 --sortBy contributions --format html --sortOrder desc' +
' --showlogin true --filter "renovate-bot,apps/renovate,renovate,renovate[bot]" >> contributors.html',
'echo "<h2>WooCommerce Blocks</h2>" >> contributors.html',
'echo "Generating contributor list for WC Blocks since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce-gutenberg-products-block' +
' --fromDate <%= fromDate %> --authToken <%= authToken %> --cols 6 --sortBy contributions --format html' +
' --sortOrder desc --showlogin true --filter "renovate-bot,apps/renovate,renovate,renovate[bot]" >> contributors.html',
'echo "<h2>Action Scheduler</h2>" >> contributors.html',
'echo "Generating contributor list for Action Scheduler since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo action-scheduler --fromDate <%= fromDate %>' +
' --authToken <%= authToken %> --cols 6 --sortBy contributions --format html --sortOrder desc' +
' --showlogin true --filter "renovate-bot,apps/renovate,renovate,renovate[bot]" >> contributors.html',
'echo "<h2>REST API</h2>" >> contributors.html',
'echo "Generating contributor list for REST API since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce-rest-api --fromDate <%= fromDate %>' +
' --authToken <%= authToken %> --cols 6 --sortBy contributions --format html --sortOrder desc' +
' --showlogin true --filter "renovate-bot,apps/renovate,renovate,renovate[bot]" >> contributors.html',
].join( '&&' )
}
},
prompt: {
contributors: {
options: {
questions: [
{
config: 'fromDate',
type: 'input',
message: 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release)'
},
{
config: 'authToken',
type: 'input',
message: 'Provide a personal access token (you must).' +
' This will allow 5000 requests per hour rather than 60 - use if nothing is generated.'
}
]
}
}
},
// PHP Code Sniffer.
@ -312,7 +262,6 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-prompt' );
// Register tasks.
grunt.registerTask( 'default', [
@ -346,11 +295,6 @@ module.exports = function( grunt ) {
'css'
]);
grunt.registerTask( 'contributors', [
'prompt:contributors',
'shell:contributors'
]);
// Only an alias to 'default' task.
grunt.registerTask( 'dev', [
'default'

32
bin/contributors.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
read -p 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release): ' from_date
read -sp 'Provide a personal access token (you must): ' auth_token
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot]"
output_file="contributors.html"
common_arguments="--owner woocommerce --fromDate $from_date --authToken $auth_token --cols 6 --sortBy contributions --format html --sortOrder desc --showlogin true --filter $ignored_users"
echo ""
echo "<h2>WooCommerce core</h2>" > $output_file
echo "Generating contributor list for WC core since $from_date"
./node_modules/.bin/githubcontrib --repo woocommerce $common_arguments >> $output_file
echo "<h2>WooCommerce Admin</h2>" >> $output_file
echo "Generating contributor list for WC Admin since $from_date"
./node_modules/.bin/githubcontrib --repo woocommerce-admin $common_arguments >> $output_file
echo "<h2>WooCommerce Blocks</h2>" >> $output_file
echo "Generating contributor list for WC Blocks since $from_date"
./node_modules/.bin/githubcontrib --repo woocommerce-gutenberg-products-block $common_arguments >> $output_file
echo "<h2>Action Scheduler</h2>" >> $output_file
echo "Generating contributor list for Action Scheduler since $from_date"
./node_modules/.bin/githubcontrib --repo action-scheduler $common_arguments >> $output_file
echo "<h2>REST API</h2>" >> $output_file
echo "Generating contributor list for REST API since $from_date"
./node_modules/.bin/githubcontrib --repo woocommerce-rest-api $common_arguments >> $output_file
echo "Output generated to $output_file."