From 80eb5ae931e9a04cc43bc91bd8066f875d7b4c03 Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Mon, 11 May 2020 11:00:42 +0200 Subject: [PATCH] Moved the contributors script from Grunt to bash. --- Gruntfile.js | 56 --------------------------------------------- bin/contributors.sh | 32 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 56 deletions(-) create mode 100755 bin/contributors.sh diff --git a/Gruntfile.js b/Gruntfile.js index a812e5db4d9..141134fccc1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -213,56 +213,6 @@ module.exports = function( grunt ) { e2e_tests_grep: { command: 'npm run --silent test:grep "' + grunt.option( 'grep' ) + '"' }, - contributors: { - command: [ - 'echo "

WooCommerce core

" > 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 "

WooCommerce Admin

" >> 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 "

WooCommerce Blocks

" >> 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 "

Action Scheduler

" >> 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 "

REST API

" >> 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' diff --git a/bin/contributors.sh b/bin/contributors.sh new file mode 100755 index 00000000000..821fd834c90 --- /dev/null +++ b/bin/contributors.sh @@ -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 "

WooCommerce core

" > $output_file +echo "Generating contributor list for WC core since $from_date" +./node_modules/.bin/githubcontrib --repo woocommerce $common_arguments >> $output_file + +echo "

WooCommerce Admin

" >> $output_file +echo "Generating contributor list for WC Admin since $from_date" +./node_modules/.bin/githubcontrib --repo woocommerce-admin $common_arguments >> $output_file + +echo "

WooCommerce Blocks

" >> $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 "

Action Scheduler

" >> $output_file +echo "Generating contributor list for Action Scheduler since $from_date" +./node_modules/.bin/githubcontrib --repo action-scheduler $common_arguments >> $output_file + +echo "

REST API

" >> $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."