From 061e5347bea4ad6617d461c45fa9cc0b432365f9 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <12731225+dshevtsov@users.noreply.github.com> Date: Fri, 14 Mar 2025 11:42:54 -0500 Subject: [PATCH 1/5] Add changes for testing --- src/pages/index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/index.md b/src/pages/index.md index 698ea90f8..3cdfd1419 100644 --- a/src/pages/index.md +++ b/src/pages/index.md @@ -10,7 +10,6 @@ keywords: ![Commerce PHP Extensions](_images/home-bg.jpeg) # Commerce PHP Extensions - Learn how to create and maintain PHP extensions for Adobe Commerce and Magento Open Source. @@ -20,7 +19,6 @@ Learn how to create and maintain PHP extensions for Adobe Commerce and Magento O - [Community Slack workspace](https://opensource.magento.com/slack) * [Contributor statistics](https://developer.adobe.com/open/magento/statistic) ## Overview - This documentation provides resources for developing PHP-based extensions for Adobe Commerce and Magento Open Source. ## Discover From 235e18cb4b27ea632c89c020a646e2cb0f868c60 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Fri, 14 Mar 2025 15:27:28 -0500 Subject: [PATCH 2/5] Decompose the pr testing workflow --- .github/workflows/lint-pr_job.yml | 48 +++++++++++++ .github/workflows/lint-pull-request.yml | 9 +++ .github/workflows/test-pull-request.yml | 3 +- .github/workflows/validate-pr_job.yml | 96 ++++++------------------- 4 files changed, 81 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/lint-pr_job.yml create mode 100644 .github/workflows/lint-pull-request.yml diff --git a/.github/workflows/lint-pr_job.yml b/.github/workflows/lint-pr_job.yml new file mode 100644 index 000000000..6fdb7230d --- /dev/null +++ b/.github/workflows/lint-pr_job.yml @@ -0,0 +1,48 @@ +name: Reusable workflow to lint a pull request + +on: workflow_call + +jobs: + lint-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup reviewdog + uses: reviewdog/action-setup@v1.3.0 + with: + reviewdog_version: v0.20.3 + + - name: Load super-linter configuration + shell: bash + run: cat .github/super-linter.env >> "$GITHUB_ENV" + + - name: Lint Code Base with super-linter and reviewdog + uses: super-linter/super-linter/slim@v7.3.0 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Report linting results with reviewdog + shell: bash + run: | + TMPFILE=$(mktemp) + git diff > "${TMPFILE}" + if [ ! -s "${TMPFILE}" ]; then + echo "No changes detected, skipping reviewdog." + exit 0 + fi + git stash --include-untracked + reviewdog \ + -f=diff \ + -f.diff.strip=1 \ + -name="markdownlint-fix" \ + -reporter="github-pr-review" \ + -filter-mode="diff_context" \ + -fail-level=error < "${TMPFILE}" + git stash drop || true + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} diff --git a/.github/workflows/lint-pull-request.yml b/.github/workflows/lint-pull-request.yml new file mode 100644 index 000000000..b5854db71 --- /dev/null +++ b/.github/workflows/lint-pull-request.yml @@ -0,0 +1,9 @@ + +name: Lint pull request + +on: pull_request_target + +jobs: + linting: + name: Check code with linters + uses: ./.github/workflows/lint-pr_job.yml diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index e3a3274ed..211d141d1 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -1,6 +1,7 @@ name: Validate pull request -on: pull_request_target +on: pull_request + permissions: contents: read statuses: write diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml index 383232175..39e29e4f5 100644 --- a/.github/workflows/validate-pr_job.yml +++ b/.github/workflows/validate-pr_job.yml @@ -1,83 +1,31 @@ ---- name: Reusable workflow to validate a pull request on: workflow_call jobs: - lint-test: + remark-test: runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup reviewdog - uses: reviewdog/action-setup@v1.3.0 - with: - reviewdog_version: v0.20.3 - - - name: Load super-linter configuration - shell: bash - run: cat .github/super-linter.env >> "$GITHUB_ENV" - - - name: Lint Code Base with super-linter and reviewdog - uses: super-linter/super-linter/slim@v7.3.0 - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Report linting results with reviewdog - shell: bash - run: | - TMPFILE=$(mktemp) - git diff > "${TMPFILE}" - if [ ! -s "${TMPFILE}" ]; then - echo "No changes detected, skipping reviewdog." - exit 0 - fi - git stash --include-untracked - reviewdog \ - -f=diff \ - -f.diff.strip=1 \ - -name="markdownlint-fix" \ - -reporter="github-pr-review" \ - -filter-mode="diff_context" \ - -fail-level=error < "${TMPFILE}" - git stash drop || true - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} + - uses: actions/checkout@v4 + - name: Use Setup Node and Install Dependencies Action + uses: commerce-docs/devsite-install-action@main + with: + node-version-file: '.nvmrc' + cache-dependency-path: 'yarn.lock' - # remark-test: - # permissions: - # contents: read - # statuses: write - # runs-on: ubuntu-latest - # needs: lint-test - # steps: - # - uses: actions/checkout@v4 - # - name: Use Setup Node and Install Dependencies Action - # uses: commerce-docs/devsite-install-action@main - # with: - # node-version-file: '.nvmrc' - # cache-dependency-path: 'yarn.lock' + - name: Check links + run: yarn test - # - name: Check links - # run: yarn test - - # build-test: - # permissions: - # contents: read - # statuses: write - # runs-on: ubuntu-latest - # needs: remark-test - # steps: - # - uses: actions/checkout@v4 - # - name: Use Setup Node and Install Dependencies Action - # uses: commerce-docs/devsite-install-action@main - # with: - # node-version-file: '.nvmrc' - # cache-dependency-path: 'yarn.lock' - - # - name: Build site - # run: yarn build + build-test: + runs-on: ubuntu-latest + needs: remark-test + steps: + - uses: actions/checkout@v4 + - name: Use Setup Node and Install Dependencies Action + uses: commerce-docs/devsite-install-action@main + with: + node-version-file: '.nvmrc' + cache-dependency-path: 'yarn.lock' + + - name: Build site + run: yarn build From 4396d66b7275cfddc8b70e3b29ed1559ebad73aa Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Fri, 14 Mar 2025 15:32:04 -0500 Subject: [PATCH 3/5] Disable unused permissions --- .github/workflows/test-pull-request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 211d141d1..ba6f0dceb 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -5,7 +5,6 @@ on: pull_request permissions: contents: read statuses: write - pull-requests: write jobs: testing: From 388eeda5c1fd82932d0bd7364f702b1dc5a3183b Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <12731225+dshevtsov@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:07:53 -0500 Subject: [PATCH 4/5] Fix --- .github/workflows/lint-pr_job.yml | 48 ------- .github/workflows/lint-pull-request.yml | 9 -- .github/workflows/validate-pr_job.yml | 168 +++++++++++++----------- 3 files changed, 88 insertions(+), 137 deletions(-) delete mode 100644 .github/workflows/lint-pr_job.yml delete mode 100644 .github/workflows/lint-pull-request.yml diff --git a/.github/workflows/lint-pr_job.yml b/.github/workflows/lint-pr_job.yml deleted file mode 100644 index 6fdb7230d..000000000 --- a/.github/workflows/lint-pr_job.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Reusable workflow to lint a pull request - -on: workflow_call - -jobs: - lint-test: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup reviewdog - uses: reviewdog/action-setup@v1.3.0 - with: - reviewdog_version: v0.20.3 - - - name: Load super-linter configuration - shell: bash - run: cat .github/super-linter.env >> "$GITHUB_ENV" - - - name: Lint Code Base with super-linter and reviewdog - uses: super-linter/super-linter/slim@v7.3.0 - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Report linting results with reviewdog - shell: bash - run: | - TMPFILE=$(mktemp) - git diff > "${TMPFILE}" - if [ ! -s "${TMPFILE}" ]; then - echo "No changes detected, skipping reviewdog." - exit 0 - fi - git stash --include-untracked - reviewdog \ - -f=diff \ - -f.diff.strip=1 \ - -name="markdownlint-fix" \ - -reporter="github-pr-review" \ - -filter-mode="diff_context" \ - -fail-level=error < "${TMPFILE}" - git stash drop || true - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} diff --git a/.github/workflows/lint-pull-request.yml b/.github/workflows/lint-pull-request.yml deleted file mode 100644 index b5854db71..000000000 --- a/.github/workflows/lint-pull-request.yml +++ /dev/null @@ -1,9 +0,0 @@ - -name: Lint pull request - -on: pull_request_target - -jobs: - linting: - name: Check code with linters - uses: ./.github/workflows/lint-pr_job.yml diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml index c5aece387..e469333d8 100644 --- a/.github/workflows/validate-pr_job.yml +++ b/.github/workflows/validate-pr_job.yml @@ -1,82 +1,90 @@ -name: Reusable workflow to validate a pull request - -on: workflow_call - -jobs: - remark-test: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup reviewdog - uses: reviewdog/action-setup@v1.3.0 - with: - reviewdog_version: v0.20.3 - - - name: Load super-linter configuration - shell: bash - run: cat .github/super-linter.env >> "$GITHUB_ENV" - - - name: Lint Code Base with super-linter and reviewdog - uses: super-linter/super-linter/slim@v7.3.0 - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Save diff results - shell: bash - run: | - TMPFILE=$(mktemp) - git diff > "${TMPFILE}" - if [ ! -s "${TMPFILE}" ]; then - echo "No changes detected, skipping artifact upload." - exit 0 - fi - mkdir -p ./artifacts - cp "${TMPFILE}" ./artifacts/diff.txt - echo "Linting issues found. Check the workflow run for details." - exit 1 - - - name: Upload diff artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: lint-results-${{ github.run_id }}-${{ github.run_attempt }} - path: artifacts/ - retention-days: 1 - - remark-test: - permissions: - contents: read - statuses: write - runs-on: ubuntu-latest - needs: lint-test - steps: - - uses: actions/checkout@v4 - - name: Use Setup Node and Install Dependencies Action - uses: commerce-docs/devsite-install-action@main +--- + name: Reusable workflow to validate a pull request + + on: workflow_call + + permissions: {} # Empty default permissions + + jobs: + lint-test: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 with: - node-version-file: '.nvmrc' - cache-dependency-path: 'yarn.lock' - - - name: Check links - run: yarn test - - build-test: - permissions: - contents: read - statuses: write - runs-on: ubuntu-latest - needs: remark-test - steps: - - uses: actions/checkout@v4 - - name: Use Setup Node and Install Dependencies Action - uses: commerce-docs/devsite-install-action@main + fetch-depth: 0 + + - name: Setup reviewdog + uses: reviewdog/action-setup@v1.3.0 with: - node-version-file: '.nvmrc' - cache-dependency-path: 'yarn.lock' - - - name: Build site - run: yarn build + reviewdog_version: v0.20.3 + + - name: Load super-linter configuration + shell: bash + run: cat .github/super-linter.env >> "$GITHUB_ENV" + + - name: Lint Code Base with super-linter and reviewdog + uses: super-linter/super-linter/slim@v7.3.0 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Save diff results + shell: bash + run: | + TMPFILE=$(mktemp) + git diff > "${TMPFILE}" + if [ ! -s "${TMPFILE}" ]; then + echo "No changes detected, skipping artifact upload." + exit 0 + fi + mkdir -p ./artifacts + cp "${TMPFILE}" ./artifacts/diff.txt + echo "Linting issues found. Check the workflow run for details." + exit 1 + + - name: Upload diff artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: lint-results-${{ github.run_id }}-${{ github.run_attempt }} + path: artifacts/ + retention-days: 1 + + remark-test: + permissions: + contents: read + statuses: write + runs-on: ubuntu-latest + needs: lint-test + steps: + - uses: actions/checkout@v4 + - name: Use Setup Node and Install Dependencies Action + uses: commerce-docs/devsite-install-action@main + with: + node-version-file: '.nvmrc' + cache-dependency-path: 'yarn.lock' + + - name: Check links + run: yarn test + + build-test: + permissions: + contents: read + statuses: write + runs-on: ubuntu-latest + needs: remark-test + steps: + - uses: actions/checkout@v4 + - name: Use Setup Node and Install Dependencies Action + uses: commerce-docs/devsite-install-action@main + with: + node-version-file: '.nvmrc' + cache-dependency-path: 'yarn.lock' + + - name: Build site + run: yarn build + \ No newline at end of file From 79692bbe133249c94890512a871c7605df8ddb79 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <12731225+dshevtsov@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:11:17 -0500 Subject: [PATCH 5/5] Fix --- .github/workflows/validate-pr_job.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml index e469333d8..009976d3c 100644 --- a/.github/workflows/validate-pr_job.yml +++ b/.github/workflows/validate-pr_job.yml @@ -3,13 +3,8 @@ on: workflow_call - permissions: {} # Empty default permissions - jobs: lint-test: - permissions: - contents: read - pull-requests: write runs-on: ubuntu-latest steps: