From 8633b208f97f83c0a5d7e2ec543a2cfcae3732f3 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:41:33 +0700 Subject: [PATCH 01/16] test branch --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index c5d8304..09abdae 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -31,6 +31,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: WPCS check - uses: 10up/wpcs-action@stable + uses: 10up/wpcs-action@try/gh-actions-summary with: use_local_config: true From fb2d65be8f07af155aab7e254b69bb695e4849b5 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:41:57 +0700 Subject: [PATCH 02/16] test branch --- includes/settings.php | 2 +- maps-block-apple.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/settings.php b/includes/settings.php index 52d3360..a51511e 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -19,7 +19,7 @@ function setup() { add_action( 'admin_menu', $n( 'admin_menu' ), 20 ); add_action( 'admin_init', $n( 'setup_fields_sections' ) ); add_action( 'admin_init', $n( 'register_settings' ) ); - add_action( 'rest_api_init', $n( 'register_settings' ) ); + add_action( 'rest_api_init', $n('register_settings' ) ); add_filter( 'plugin_action_links_' . MAPS_BLOCK_APPLE_BASENAME, $n( 'plugin_filter_action_links' ) ); add_action( 'admin_enqueue_scripts', $n( 'enqueue_settings_assets' ) ); } diff --git a/maps-block-apple.php b/maps-block-apple.php index 7a244bf..a0e25e4 100644 --- a/maps-block-apple.php +++ b/maps-block-apple.php @@ -18,7 +18,7 @@ namespace tenup\Maps_Block_Apple; // Useful global constants. -define( 'MAPS_BLOCK_APPLE_VERSION', '1.0.2' ); +define('MAPS_BLOCK_APPLE_VERSION','1.0.2' ); define( 'MAPS_BLOCK_APPLE_URL', plugin_dir_url( __FILE__ ) ); define( 'MAPS_BLOCK_APPLE_PATH', dirname( __FILE__ ) . '/' ); define( 'MAPS_BLOCK_APPLE_INC', MAPS_BLOCK_APPLE_PATH . 'includes/' ); @@ -50,7 +50,7 @@ function add_options() { } add_action( 'init', __NAMESPACE__ . '\add_options' ); -require_once MAPS_BLOCK_APPLE_INC . 'block-assets.php'; +require_once MAPS_BLOCK_APPLE_INC.'block-assets.php'; require_once MAPS_BLOCK_APPLE_INC . 'rest-routes.php'; require_once MAPS_BLOCK_APPLE_INC . 'settings.php'; From 5ac61dc4a22b77b5f901d90da4d65108fa26692a Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:51:25 +0700 Subject: [PATCH 03/16] add summary step --- .github/workflows/linting.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 09abdae..7e3d7c4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -34,3 +34,7 @@ jobs: uses: 10up/wpcs-action@try/gh-actions-summary with: use_local_config: true + - name: Update summary + run: | + npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md + cat phpcs.md >> $GITHUB_STEP_SUMMARY From c0950329741feb293294cdbd52ae645128414996 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:54:08 +0700 Subject: [PATCH 04/16] always run step --- .github/workflows/linting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7e3d7c4..d986258 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -38,3 +38,4 @@ jobs: run: | npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md cat phpcs.md >> $GITHUB_STEP_SUMMARY + if: always() From 5bb16b41bb941b83c53f1060a74abe2e83886815 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 14:28:34 +0700 Subject: [PATCH 05/16] use extra_args --- .github/workflows/linting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index d986258..dc17e38 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -34,6 +34,7 @@ jobs: uses: 10up/wpcs-action@try/gh-actions-summary with: use_local_config: true + extra_args: '--report-json=./phpcs.json' - name: Update summary run: | npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md From 7857301cef922849d71da0fabd9f869820188522 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 14:30:59 +0700 Subject: [PATCH 06/16] test --- .github/workflows/linting.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index dc17e38..ef6eeff 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -37,6 +37,8 @@ jobs: extra_args: '--report-json=./phpcs.json' - name: Update summary run: | + pwd + ls npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md cat phpcs.md >> $GITHUB_STEP_SUMMARY if: always() From fa90015dfda16c50224e2b79a3766ceecd49edca Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 15:24:26 +0700 Subject: [PATCH 07/16] try: eslint summary --- .github/workflows/linting.yml | 27 +++++++++++++++++---------- src/admin-settings.js | 6 ++++-- src/block-icon.js | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index ef6eeff..e1586f8 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,10 +21,19 @@ jobs: node-version: 12 - name: npm install run: npm install - - name: eslint - uses: icrawl/action-eslint@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate linting report + run: npm run lint:js -- --output-file eslint-report.json --format json + continue-on-error: true + - name: Annotate code linting results + uses: ataylorme/eslint-annotate-action@1.2.0 + continue-on-error: true + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + report-json: 'eslint-report.json' + - name: Update summary + run: | + npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md + cat eslint-report.md >> $GITHUB_STEP_SUMMARY phpcs: name: WPCS runs-on: ubuntu-latest @@ -32,13 +41,11 @@ jobs: - uses: actions/checkout@v2 - name: WPCS check uses: 10up/wpcs-action@try/gh-actions-summary + continue-on-error: true with: use_local_config: true - extra_args: '--report-json=./phpcs.json' + extra_args: '--report-json=./phpcs-report.json' - name: Update summary run: | - pwd - ls - npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md - cat phpcs.md >> $GITHUB_STEP_SUMMARY - if: always() + npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md + cat phpcs-report.md >> $GITHUB_STEP_SUMMARY diff --git a/src/admin-settings.js b/src/admin-settings.js index f613735..a0bad49 100644 --- a/src/admin-settings.js +++ b/src/admin-settings.js @@ -1,3 +1,4 @@ +/* eslint jsdoc/check-tag-names: "warn" */ import apiFetch from '@wordpress/api-fetch'; import { __ } from '@wordpress/i18n'; @@ -10,7 +11,7 @@ if (!privateKeyInput.value && !keyIdInput.value && !teamIdInput.value) { statusEl.closest('tr').style.display = 'none'; } else { setTimeout(() => { - apiFetch({ path: 'MapsBlockApple/v1/GetJWT/' }) + apiFetch({ path: 'MapsBlockApple/v1/GetJWT/'}) .then((token) => { mapkit.init({ authorizationCallback(done) { @@ -25,7 +26,7 @@ if (!privateKeyInput.value && !keyIdInput.value && !teamIdInput.value) { } mapkit.addEventListener('error', () => { - addNotice(__('Invalid credentials!'), 'error'); + addNotice(__('Invalid credentials!'), 'error') }); mapkit.addEventListener('configuration-change', () => { @@ -36,6 +37,7 @@ mapkit.addEventListener('configuration-change', () => { * * @param {string} message Notice message. * @param {string} type Notice type. error|valid. + * @yields */ const addNotice = (message, type) => { statusEl.className = ''; diff --git a/src/block-icon.js b/src/block-icon.js index 9cabb8e..0e8c475 100644 --- a/src/block-icon.js +++ b/src/block-icon.js @@ -1,4 +1,4 @@ -function BlockIcon() { +function BlockIcon(){ return ( Date: Mon, 16 May 2022 15:34:23 +0700 Subject: [PATCH 08/16] fix report command --- .github/workflows/linting.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index e1586f8..817a7d4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -32,7 +32,7 @@ jobs: report-json: 'eslint-report.json' - name: Update summary run: | - npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md + npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md cat eslint-report.md >> $GITHUB_STEP_SUMMARY phpcs: name: WPCS @@ -41,11 +41,11 @@ jobs: - uses: actions/checkout@v2 - name: WPCS check uses: 10up/wpcs-action@try/gh-actions-summary - continue-on-error: true with: use_local_config: true extra_args: '--report-json=./phpcs-report.json' - name: Update summary run: | - npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md + npm_config_yes=true npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md cat phpcs-report.md >> $GITHUB_STEP_SUMMARY + if: always() From e939b1d0ce7c87bc6857e45282313d2f341336c4 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 15:42:10 +0700 Subject: [PATCH 09/16] try: use default node version --- .github/workflows/linting.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 817a7d4..9382dd2 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -15,10 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: install node v12 - uses: actions/setup-node@v1 - with: - node-version: 12 - name: npm install run: npm install - name: Generate linting report @@ -46,6 +42,6 @@ jobs: extra_args: '--report-json=./phpcs-report.json' - name: Update summary run: | - npm_config_yes=true npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md + npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md cat phpcs-report.md >> $GITHUB_STEP_SUMMARY if: always() From 3aab9d5c70d5f73bb0b62657b3cb47e89b5839a8 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 15:47:28 +0700 Subject: [PATCH 10/16] use if: always to avoid marking failed check as passing --- .github/workflows/linting.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 9382dd2..b4917fc 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -14,22 +14,23 @@ jobs: name: eslint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: npm install - run: npm install - - name: Generate linting report - run: npm run lint:js -- --output-file eslint-report.json --format json - continue-on-error: true - - name: Annotate code linting results - uses: ataylorme/eslint-annotate-action@1.2.0 - continue-on-error: true - with: - repo-token: '${{ secrets.GITHUB_TOKEN }}' - report-json: 'eslint-report.json' - - name: Update summary - run: | - npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md - cat eslint-report.md >> $GITHUB_STEP_SUMMARY + - uses: actions/checkout@v2 + - name: npm install + run: npm install + - name: Generate linting report + run: npm run lint:js -- --output-file eslint-report.json --format json + - name: Annotate code linting results + uses: ataylorme/eslint-annotate-action@1.2.0 + continue-on-error: true + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + report-json: 'eslint-report.json' + if: always() + - name: Update summary + run: | + npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md + cat eslint-report.md >> $GITHUB_STEP_SUMMARY + if: always() phpcs: name: WPCS runs-on: ubuntu-latest From 8824f1268d6da45ae7655045a4c360ef465369eb Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 15:48:04 +0700 Subject: [PATCH 11/16] remove left over continue on error flag --- .github/workflows/linting.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b4917fc..c58e67e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,7 +21,6 @@ jobs: run: npm run lint:js -- --output-file eslint-report.json --format json - name: Annotate code linting results uses: ataylorme/eslint-annotate-action@1.2.0 - continue-on-error: true with: repo-token: '${{ secrets.GITHUB_TOKEN }}' report-json: 'eslint-report.json' From 29faf83417ce9e6316398cba841966a77525211f Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 16:40:29 +0700 Subject: [PATCH 12/16] use continue on error for linting step only --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index c58e67e..a8cf212 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -19,12 +19,12 @@ jobs: run: npm install - name: Generate linting report run: npm run lint:js -- --output-file eslint-report.json --format json + continue-on-error: true - name: Annotate code linting results uses: ataylorme/eslint-annotate-action@1.2.0 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' report-json: 'eslint-report.json' - if: always() - name: Update summary run: | npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md From 5e74199ffb2e468c2d1d9733b49ea7c15dd02f50 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 18:02:15 +0700 Subject: [PATCH 13/16] only run report action on failure --- .github/workflows/linting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index a8cf212..5d2d4e9 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -29,7 +29,7 @@ jobs: run: | npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md cat eslint-report.md >> $GITHUB_STEP_SUMMARY - if: always() + if: ${{ failure() }} phpcs: name: WPCS runs-on: ubuntu-latest @@ -44,4 +44,4 @@ jobs: run: | npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md cat phpcs-report.md >> $GITHUB_STEP_SUMMARY - if: always() + if: ${{ failure() }} From 3849fb5a0bc7f10fa607f21bf5252e0e4077d820 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Tue, 17 May 2022 10:40:11 +0700 Subject: [PATCH 14/16] remove test liniting error --- includes/settings.php | 2 +- maps-block-apple.php | 4 ++-- src/admin-settings.js | 6 ++---- src/block-icon.js | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/includes/settings.php b/includes/settings.php index a51511e..52d3360 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -19,7 +19,7 @@ function setup() { add_action( 'admin_menu', $n( 'admin_menu' ), 20 ); add_action( 'admin_init', $n( 'setup_fields_sections' ) ); add_action( 'admin_init', $n( 'register_settings' ) ); - add_action( 'rest_api_init', $n('register_settings' ) ); + add_action( 'rest_api_init', $n( 'register_settings' ) ); add_filter( 'plugin_action_links_' . MAPS_BLOCK_APPLE_BASENAME, $n( 'plugin_filter_action_links' ) ); add_action( 'admin_enqueue_scripts', $n( 'enqueue_settings_assets' ) ); } diff --git a/maps-block-apple.php b/maps-block-apple.php index a0e25e4..92c054b 100644 --- a/maps-block-apple.php +++ b/maps-block-apple.php @@ -18,7 +18,7 @@ namespace tenup\Maps_Block_Apple; // Useful global constants. -define('MAPS_BLOCK_APPLE_VERSION','1.0.2' ); +define( 'MAPS_BLOCK_APPLE_VERSION' , '1.0.2' ); define( 'MAPS_BLOCK_APPLE_URL', plugin_dir_url( __FILE__ ) ); define( 'MAPS_BLOCK_APPLE_PATH', dirname( __FILE__ ) . '/' ); define( 'MAPS_BLOCK_APPLE_INC', MAPS_BLOCK_APPLE_PATH . 'includes/' ); @@ -50,7 +50,7 @@ function add_options() { } add_action( 'init', __NAMESPACE__ . '\add_options' ); -require_once MAPS_BLOCK_APPLE_INC.'block-assets.php'; +require_once MAPS_BLOCK_APPLE_INC .'block-assets.php'; require_once MAPS_BLOCK_APPLE_INC . 'rest-routes.php'; require_once MAPS_BLOCK_APPLE_INC . 'settings.php'; diff --git a/src/admin-settings.js b/src/admin-settings.js index a0bad49..f613735 100644 --- a/src/admin-settings.js +++ b/src/admin-settings.js @@ -1,4 +1,3 @@ -/* eslint jsdoc/check-tag-names: "warn" */ import apiFetch from '@wordpress/api-fetch'; import { __ } from '@wordpress/i18n'; @@ -11,7 +10,7 @@ if (!privateKeyInput.value && !keyIdInput.value && !teamIdInput.value) { statusEl.closest('tr').style.display = 'none'; } else { setTimeout(() => { - apiFetch({ path: 'MapsBlockApple/v1/GetJWT/'}) + apiFetch({ path: 'MapsBlockApple/v1/GetJWT/' }) .then((token) => { mapkit.init({ authorizationCallback(done) { @@ -26,7 +25,7 @@ if (!privateKeyInput.value && !keyIdInput.value && !teamIdInput.value) { } mapkit.addEventListener('error', () => { - addNotice(__('Invalid credentials!'), 'error') + addNotice(__('Invalid credentials!'), 'error'); }); mapkit.addEventListener('configuration-change', () => { @@ -37,7 +36,6 @@ mapkit.addEventListener('configuration-change', () => { * * @param {string} message Notice message. * @param {string} type Notice type. error|valid. - * @yields */ const addNotice = (message, type) => { statusEl.className = ''; diff --git a/src/block-icon.js b/src/block-icon.js index 0e8c475..9cabb8e 100644 --- a/src/block-icon.js +++ b/src/block-icon.js @@ -1,4 +1,4 @@ -function BlockIcon(){ +function BlockIcon() { return ( Date: Tue, 17 May 2022 10:48:52 +0700 Subject: [PATCH 15/16] fix phpcs linting errors --- maps-block-apple.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maps-block-apple.php b/maps-block-apple.php index 92c054b..7a244bf 100644 --- a/maps-block-apple.php +++ b/maps-block-apple.php @@ -18,7 +18,7 @@ namespace tenup\Maps_Block_Apple; // Useful global constants. -define( 'MAPS_BLOCK_APPLE_VERSION' , '1.0.2' ); +define( 'MAPS_BLOCK_APPLE_VERSION', '1.0.2' ); define( 'MAPS_BLOCK_APPLE_URL', plugin_dir_url( __FILE__ ) ); define( 'MAPS_BLOCK_APPLE_PATH', dirname( __FILE__ ) . '/' ); define( 'MAPS_BLOCK_APPLE_INC', MAPS_BLOCK_APPLE_PATH . 'includes/' ); @@ -50,7 +50,7 @@ function add_options() { } add_action( 'init', __NAMESPACE__ . '\add_options' ); -require_once MAPS_BLOCK_APPLE_INC .'block-assets.php'; +require_once MAPS_BLOCK_APPLE_INC . 'block-assets.php'; require_once MAPS_BLOCK_APPLE_INC . 'rest-routes.php'; require_once MAPS_BLOCK_APPLE_INC . 'settings.php'; From 49bce26b8ab67be3eeed1665d86f2285208bc2d1 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Wed, 15 Jun 2022 08:17:31 +0700 Subject: [PATCH 16/16] change the wpcs action branch back to stable --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 5d2d4e9..463b069 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -36,7 +36,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: WPCS check - uses: 10up/wpcs-action@try/gh-actions-summary + uses: 10up/wpcs-action@stable with: use_local_config: true extra_args: '--report-json=./phpcs-report.json'