From f2ada27f78e4f54e129c32a426aebd414ff7bc7a Mon Sep 17 00:00:00 2001 From: Eason Su Date: Thu, 16 May 2024 12:04:41 +0800 Subject: [PATCH] Upgrade GitHub Actions workflows to use Node.js v20. --- .github/workflows/backlog-automation.yml | 11 +++++------ .github/workflows/branch-labels.yml | 8 ++++++-- .github/workflows/build.yml | 10 +++++----- .github/workflows/e2e-tests.yml | 8 ++++---- .github/workflows/js-css-linting.yml | 12 ++++++------ .github/workflows/js-unit-tests.yml | 6 +++--- .github/workflows/php-coding-standards.yml | 4 ++-- .github/workflows/php-hook-documentation.yml | 4 ++-- .github/workflows/php-unit-tests.yml | 18 +++++++++--------- .github/workflows/post-release-merge.yml | 2 +- .github/workflows/prepare-release.yml | 4 ++-- .github/workflows/run-qit.yml | 4 ++-- 12 files changed, 47 insertions(+), 44 deletions(-) diff --git a/.github/workflows/backlog-automation.yml b/.github/workflows/backlog-automation.yml index c56f20cebc..dbe5d435b9 100644 --- a/.github/workflows/backlog-automation.yml +++ b/.github/workflows/backlog-automation.yml @@ -5,20 +5,19 @@ on: types: - opened - transferred - pull_request: + pull_request_target: types: - opened -# Leverage project write access for dependabot. -permissions: - repository-projects: write - jobs: add-to-project: name: Add issue/PR to project + permissions: + contents: read + pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/add-to-project@v0.4.0 + - uses: actions/add-to-project@v1.0.1 with: project-url: https://github.com/orgs/woocommerce/projects/119 github-token: ${{ secrets.BOT_GH_TOKEN }} diff --git a/.github/workflows/branch-labels.yml b/.github/workflows/branch-labels.yml index 8c80a99a57..995611194d 100644 --- a/.github/workflows/branch-labels.yml +++ b/.github/workflows/branch-labels.yml @@ -1,11 +1,15 @@ name: Set PR Labels on: - pull_request: + pull_request_target: types: opened + jobs: SetLabels: + permissions: + contents: read + pull-requests: write runs-on: ubuntu-latest steps: - name: Set Labels - uses: woocommerce/grow/branch-label@actions-v1 + uses: woocommerce/grow/branch-label@actions-v2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a957b7ef0..12ebe4bd36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,15 +20,15 @@ jobs: FORCE_COLOR: 2 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 + uses: woocommerce/grow/prepare-php@actions-v2 with: install-deps: "no" - name: Prepare node - uses: woocommerce/grow/prepare-node@actions-v1 + uses: woocommerce/grow/prepare-node@actions-v2 with: node-version-file: ".nvmrc" ignore-scripts: "no" @@ -69,13 +69,13 @@ jobs: - name: Publish dev build to GitHub if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }} - uses: woocommerce/grow/publish-extension-dev-build@actions-v1 + uses: woocommerce/grow/publish-extension-dev-build@actions-v2 with: extension-asset-path: google-listings-and-ads.zip - name: Publish build artifact if: ${{ ! ( github.event_name == 'push' && github.ref_name == 'develop' ) }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: google-listings-and-ads.zip path: ${{ github.workspace }}/google-listings-and-ads.zip diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 605321bf20..3b703da4f6 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -26,15 +26,15 @@ jobs: FORCE_COLOR: 2 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 + uses: woocommerce/grow/prepare-php@actions-v2 with: install-deps: "no" - name: Prepare node - uses: woocommerce/grow/prepare-node@actions-v1 + uses: woocommerce/grow/prepare-node@actions-v2 with: node-version-file: ".nvmrc" ignore-scripts: "no" @@ -72,7 +72,7 @@ jobs: - name: Archive e2e failure screenshots if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: e2e-screenshots path: tests/e2e/test-results/report/**/*.png diff --git a/.github/workflows/js-css-linting.yml b/.github/workflows/js-css-linting.yml index fde37633ee..9cea370a73 100644 --- a/.github/workflows/js-css-linting.yml +++ b/.github/workflows/js-css-linting.yml @@ -28,15 +28,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare node - uses: woocommerce/grow/prepare-node@actions-v1 + uses: woocommerce/grow/prepare-node@actions-v2 with: node-version-file: ".nvmrc" - name: Prepare annotation formatter - uses: woocommerce/grow/eslint-annotation@actions-v1 + uses: woocommerce/grow/eslint-annotation@actions-v2 - name: Lint JavaScript and annotate linting errors run: npm run lint:js -- --quiet --format ./eslintFormatter.cjs @@ -46,15 +46,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare node - uses: woocommerce/grow/prepare-node@actions-v1 + uses: woocommerce/grow/prepare-node@actions-v2 with: node-version-file: ".nvmrc" - name: Prepare annotation formatter - uses: woocommerce/grow/stylelint-annotation@actions-v1 + uses: woocommerce/grow/stylelint-annotation@actions-v2 - name: Lint CSS and annotate linting errors run: npm run lint:css -- --custom-formatter ./stylelintFormatter.cjs diff --git a/.github/workflows/js-unit-tests.yml b/.github/workflows/js-unit-tests.yml index b1d631d6eb..786bba518e 100644 --- a/.github/workflows/js-unit-tests.yml +++ b/.github/workflows/js-unit-tests.yml @@ -29,10 +29,10 @@ jobs: FORCE_COLOR: 2 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare node - uses: woocommerce/grow/prepare-node@actions-v1 + uses: woocommerce/grow/prepare-node@actions-v2 with: node-version-file: ".nvmrc" @@ -40,7 +40,7 @@ jobs: run: npm run test:js - name: Upload JS unit coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: coverage/clover.xml flags: js-unit-tests diff --git a/.github/workflows/php-coding-standards.yml b/.github/workflows/php-coding-standards.yml index bbf51d2136..5b6cdd613d 100644 --- a/.github/workflows/php-coding-standards.yml +++ b/.github/workflows/php-coding-standards.yml @@ -23,10 +23,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 + uses: woocommerce/grow/prepare-php@actions-v2 with: tools: cs2pr diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml index def712f287..69701507a5 100644 --- a/.github/workflows/php-hook-documentation.yml +++ b/.github/workflows/php-hook-documentation.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # Checks out a branch instead of a commit in detached HEAD state ref: ${{ github.head_ref }} @@ -26,7 +26,7 @@ jobs: # 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 + uses: woocommerce/grow/hook-documentation@actions-v2 with: source-directories: src/,views/,google-listings-and-ads.php,uninstall.php diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index ad898c3bc7..d630c43700 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -44,12 +44,12 @@ jobs: steps: - name: Get Release versions from Wordpress id: wp - uses: woocommerce/grow/get-plugin-releases@actions-v1 + uses: woocommerce/grow/get-plugin-releases@actions-v2 with: slug: wordpress - name: Get Release versions from WooCommerce id: wc - uses: woocommerce/grow/get-plugin-releases@actions-v1 + uses: woocommerce/grow/get-plugin-releases@actions-v2 with: slug: woocommerce @@ -77,20 +77,20 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - if: matrix.wc-versions == needs.GetMatrix.outputs.latest-wc-version && matrix.php == 8.2 name: Set condition to generate coverage report (only on latest versions) run: echo "generate_coverage=true" >> $GITHUB_ENV - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 + uses: woocommerce/grow/prepare-php@actions-v2 with: php-version: "${{ matrix.php }}" coverage: "${{ env.generate_coverage == 'true' && 'xdebug' || 'none' }}" - name: Prepare MySQL - uses: woocommerce/grow/prepare-mysql@actions-v1 + uses: woocommerce/grow/prepare-mysql@actions-v2 - name: Install WP tests run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }} @@ -105,7 +105,7 @@ jobs: - if: env.generate_coverage == 'true' name: Upload PHP unit coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: tests/php-coverage/report.xml flags: php-unit-tests @@ -121,15 +121,15 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 + uses: woocommerce/grow/prepare-php@actions-v2 with: php-version: "${{ inputs.php-version }}" - name: Prepare MySQL - uses: woocommerce/grow/prepare-mysql@actions-v1 + uses: woocommerce/grow/prepare-mysql@actions-v2 - name: Install WP tests env: diff --git a/.github/workflows/post-release-merge.yml b/.github/workflows/post-release-merge.yml index bbdf939fdf..41219eb7ab 100644 --- a/.github/workflows/post-release-merge.yml +++ b/.github/workflows/post-release-merge.yml @@ -15,4 +15,4 @@ jobs: MergeTrunkDevelopPR: runs-on: ubuntu-latest steps: - - uses: woocommerce/grow/merge-trunk-develop-pr@actions-v1 + - uses: woocommerce/grow/merge-trunk-develop-pr@actions-v2 diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 5ce1d4bd1b..d1aa3cd0fc 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -27,10 +27,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create branch & PR - uses: woocommerce/grow/prepare-extension-release@actions-v1 + uses: woocommerce/grow/prepare-extension-release@actions-v2 with: version: ${{ github.event.inputs.version }} type: ${{ github.event.inputs.type }} diff --git a/.github/workflows/run-qit.yml b/.github/workflows/run-qit.yml index 0fc1ef0917..7f7383c84e 100644 --- a/.github/workflows/run-qit.yml +++ b/.github/workflows/run-qit.yml @@ -58,12 +58,12 @@ jobs: needs: build steps: - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: google-listings-and-ads.zip - name: Run QIT Tests # Update it with more stable path once merged. - uses: woocommerce/grow/run-qit-extension@actions-v1 + uses: woocommerce/grow/run-qit-extension@actions-v2 with: qit-partner-user: ${{ secrets.QIT_PARTNER_USER }} qit-partner-secret: ${{ secrets.QIT_PARTNER_SECRET }}