From ef7100ee54c0778ad0be60438bb437f1d415ce42 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:56:45 +0400 Subject: [PATCH 1/8] Add Workflow for generating Hooks Documentation --- .github/workflows/php-hook-documentation.yml | 58 ++++++++++++++++++++ README.md | 4 ++ docs/Hooks.md | 0 3 files changed, 62 insertions(+) create mode 100644 .github/workflows/php-hook-documentation.yml create mode 100644 docs/Hooks.md diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml new file mode 100644 index 00000000..14177145 --- /dev/null +++ b/.github/workflows/php-hook-documentation.yml @@ -0,0 +1,58 @@ +name: PHP Hook Documentation Generator + +on: + push: + branches: + - "release/**" + paths: + - "**.php" + - .github/workflows/php-hook-documentation.yml + pull_request: + types: + - opened + branches: + - "release/**" + paths: + - "**.php" + - .github/workflows/php-hook-documentation.yml + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + HookDocumentation: + name: Hook Documentation Generator + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + # Checks out a branch instead of a commit in detached HEAD state + ref: ${{ github.head_ref }} + + # This generates the documentation string. The `id` property is used to reference the output in the next step. + - name: Generate hook documentation + id: generate-hook-docs + uses: woocommerce/grow/hook-documentation@actions-v1 + with: + debug-output: yes + source-directories: includes/ woocommerce-google-analytics-integration.php + + - name: Commit hook documentation + shell: bash + # Use the github-actions bot account to commit. + # https://api.github.com/users/github-actions%5Bbot%5D + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + echo "${{ steps.generate-hook-docs.outputs.hook-docs }}" > docs/Hooks.md + git add docs/Hooks.md + if git diff --cached --quiet; then + echo "*No documentation changes to commit.*" >> $GITHUB_STEP_SUMMARY + else + echo "*Committing documentation changes.*" >> $GITHUB_STEP_SUMMARY + git commit -q -m "Update hooks documentation from ${{ github.head_ref }} branch." + git push + fi diff --git a/README.md b/README.md index 50a127a9..cdd8adc3 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,7 @@ _For more info see: [WordPress.org > Plugin Unit Tests](https://make.wordpress.o 2. Run `npm run lint:php` Alternatively, run `npm run lint:php:diff` to run coding standards checks agains the current git diff. An explanation of output can be [found here](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage#printing-progress-information) e.g. what are the S's? + +## Docs + +- [Hooks defined or used in WooCommerce Google Analytics Integration](./docs/Hooks.md) diff --git a/docs/Hooks.md b/docs/Hooks.md new file mode 100644 index 00000000..e69de29b From b9c28c9db9265b58943ccc958c9d7e84c428c61d Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:08:18 +0400 Subject: [PATCH 2/8] Fix relase trigger --- .github/workflows/php-hook-documentation.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml index 14177145..3cd53b6d 100644 --- a/.github/workflows/php-hook-documentation.yml +++ b/.github/workflows/php-hook-documentation.yml @@ -5,16 +5,7 @@ on: branches: - "release/**" paths: - - "**.php" - - .github/workflows/php-hook-documentation.yml - pull_request: - types: - - opened - branches: - - "release/**" - paths: - - "**.php" - - .github/workflows/php-hook-documentation.yml + - changelog.txt # Run the workflow only after the last commit of Woo Release. When it updates the changelog. workflow_dispatch: concurrency: @@ -37,7 +28,6 @@ jobs: id: generate-hook-docs uses: woocommerce/grow/hook-documentation@actions-v1 with: - debug-output: yes source-directories: includes/ woocommerce-google-analytics-integration.php - name: Commit hook documentation From c3828d5312176f49fe15a56412008ce221e3a02c Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:11:06 +0400 Subject: [PATCH 3/8] Simulate update changelog --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index de3c8711..88263772 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ *** Changelog *** + = 1.8.4 - 2023-08-08 = * Dev - Add release preparation GH workflow. * Fix - Add async attribute in `google-tag-manager` script. From e81274d8e11ce4c50567affff6dc1d82606e049e Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:15:09 +0400 Subject: [PATCH 4/8] Add debug to true --- .github/workflows/php-hook-documentation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml index 3cd53b6d..e165dda6 100644 --- a/.github/workflows/php-hook-documentation.yml +++ b/.github/workflows/php-hook-documentation.yml @@ -28,6 +28,7 @@ jobs: id: generate-hook-docs uses: woocommerce/grow/hook-documentation@actions-v1 with: + debug-output: yes source-directories: includes/ woocommerce-google-analytics-integration.php - name: Commit hook documentation From e2621507048da79b2285b45417da91a28c36b2c2 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:17:56 +0400 Subject: [PATCH 5/8] Simulate changelog update --- changelog.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 88263772..de3c8711 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,5 @@ *** Changelog *** - = 1.8.4 - 2023-08-08 = * Dev - Add release preparation GH workflow. * Fix - Add async attribute in `google-tag-manager` script. From 5a822245229a55c0f3309ad4be97ff7116983949 Mon Sep 17 00:00:00 2001 From: Eason Su Date: Thu, 24 Aug 2023 18:04:14 +0800 Subject: [PATCH 6/8] Fix the format of `source-directories` parameter in the php-hook-documentation.yml workflow. --- .github/workflows/php-hook-documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml index e165dda6..9f706075 100644 --- a/.github/workflows/php-hook-documentation.yml +++ b/.github/workflows/php-hook-documentation.yml @@ -29,7 +29,7 @@ jobs: uses: woocommerce/grow/hook-documentation@actions-v1 with: debug-output: yes - source-directories: includes/ woocommerce-google-analytics-integration.php + source-directories: includes/,woocommerce-google-analytics-integration.php - name: Commit hook documentation shell: bash From 60029d985e86663e16327c9e81ffc25abceb3fb3 Mon Sep 17 00:00:00 2001 From: Eason Su Date: Thu, 24 Aug 2023 18:05:57 +0800 Subject: [PATCH 7/8] Simulate changelog update --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index de3c8711..920182c6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ *** Changelog *** +test + = 1.8.4 - 2023-08-08 = * Dev - Add release preparation GH workflow. * Fix - Add async attribute in `google-tag-manager` script. From 1764a5bdd881e577be99fe52ba9daa2cd7e4b37a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 10:06:18 +0000 Subject: [PATCH 8/8] Update hooks documentation from branch. --- docs/Hooks.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/docs/Hooks.md b/docs/Hooks.md index e69de29b..b469bfc5 100644 --- a/docs/Hooks.md +++ b/docs/Hooks.md @@ -0,0 +1,141 @@ +# Hooks Reference + +A list of hooks, e.g. `actions` and `filters`, that are defined or used in this project. + +## wc_google_analytics_send_pageview + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L192](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L192) + +## woocommerce_cart_item_product + +**Type**: filter + +**Used in**: + +- [class-wc-google-gtag-js.php#L443](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-gtag-js.php#L443) +- [class-wc-google-analytics-js.php#L482](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L482) + +## woocommerce_ga_classic_snippet_output + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L105](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L105) + +## woocommerce_ga_disable_tracking + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics.php#L503](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics.php#L503) + +## woocommerce_ga_event_tracking_parameters + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L509](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L509) + +## woocommerce_ga_snippet_create + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L283](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L283) + +## woocommerce_ga_snippet_developer_id + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L284](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L284) + +## woocommerce_ga_snippet_head + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L282](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L282) + +## woocommerce_ga_snippet_output + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L289](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L289) + +## woocommerce_ga_snippet_require + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L285](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L285) + +## woocommerce_ga_tracker_variable + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L44](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L44) + +## woocommerce_google_analytics_script_src + +**Type**: filter + +**Used in**: + +- [class-wc-google-analytics-js.php#L242](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-analytics-js.php#L242) + +## woocommerce_gtag_event_data + +**Type**: filter + +**Used in**: + +- [class-wc-google-gtag-js.php#L126](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-gtag-js.php#L126) + +## woocommerce_gtag_event_tracking_parameters + +**Type**: filter + +**Used in**: + +- [class-wc-google-gtag-js.php#L486](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-gtag-js.php#L486) + +## woocommerce_gtag_snippet + +**Type**: filter + +**Used in**: + +- [class-wc-google-gtag-js.php#L327](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-gtag-js.php#L327) + +## woocommerce_gtag_tracker_variable + +**Type**: filter + +**Used in**: + +- [class-wc-google-gtag-js.php#L88](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/includes/class-wc-google-gtag-js.php#L88) + +## plugin_locale + +**Type**: filter + +**Used in**: + +- [woocommerce-google-analytics-integration.php#L135](https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/60029d985e86663e16327c9e81ffc25abceb3fb3/woocommerce-google-analytics-integration.php#L135) +