From 457b57019bbd636eb0ab0833af955562b1cec615 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 12 Mar 2025 18:03:31 -0500 Subject: [PATCH 1/3] Add reviewdog * Enable suggested fixes for Markdown --- .github/super-linter.env | 2 +- .github/workflows/test-pull-request.yml | 1 + .github/workflows/validate-pr_job.yml | 54 ++++++++++++++++++------- .gitignore | 9 ++++- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/.github/super-linter.env b/.github/super-linter.env index 62713a336..44ef4cb23 100644 --- a/.github/super-linter.env +++ b/.github/super-linter.env @@ -1,8 +1,8 @@ +FIX_MARKDOWN=true IGNORE_GITIGNORED_FILES=true MARKDOWN_CONFIG_FILE=.markdownlint.yml VALIDATE_ALL_CODEBASE=false VALIDATE_GIT_MERGE_CONFLICT_MARKERS=true VALIDATE_GITHUB_ACTIONS=true -VALIDATE_JSON=true VALIDATE_MARKDOWN=true VALIDATE_YAML=true diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 9b631cf27..e6403b4fe 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -6,6 +6,7 @@ permissions: contents: read statuses: write + pull-requests: write jobs: testing: diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml index 6f82a5ea3..d68280e2a 100644 --- a/.github/workflows/validate-pr_job.yml +++ b/.github/workflows/validate-pr_job.yml @@ -3,26 +3,50 @@ name: Reusable workflow to validate a pull request on: workflow_call -permissions: - contents: read - statuses: write - jobs: lint-test: runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Load super-linter configuration - run: cat .github/super-linter.env >> "$GITHUB_ENV" - - - name: Lint Code Base - uses: super-linter/super-linter/slim@v7.2.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - 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: ${{ secrets.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: ${{ secrets.GITHUB_TOKEN }} remark-test: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 658b80331..f59620d4e 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,11 @@ local-test.yml .yalc yalc.lock -tmp/ \ No newline at end of file +tmp/ + +# Super-linter outputs +super-linter-output +super-linter.log + +# GitHub Actions leftovers +github_conf From fba41f188e24d2efbd944e1251242eb6053ebc5f Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Thu, 13 Mar 2025 17:07:47 -0500 Subject: [PATCH 2/3] Break Markdown linter rules for testing --- src/pages/index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/index.md b/src/pages/index.md index 2e2171ea0..bae0a48c7 100644 --- a/src/pages/index.md +++ b/src/pages/index.md @@ -10,15 +10,14 @@ 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. +Learn how to create and maintain PHP extensions for Adobe Commerce and Magento Open Source. ## Resources * [Commerce open-source projects](https://developer.adobe.com/open/magento) -* [Community Slack workspace](https://opensource.magento.com/slack) +- [Community Slack workspace](https://opensource.magento.com/slack) * [Contributor statistics](https://developer.adobe.com/open/magento/statistic) ## Overview From 389744b4c42a0a6879c855e9121e77d870086309 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Thu, 13 Mar 2025 17:11:30 -0500 Subject: [PATCH 3/3] Delete reviewdog 'name' --- .github/workflows/validate-pr_job.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml index d68280e2a..e68ff3df5 100644 --- a/.github/workflows/validate-pr_job.yml +++ b/.github/workflows/validate-pr_job.yml @@ -40,7 +40,6 @@ jobs: reviewdog \ -f=diff \ -f.diff.strip=1 \ - -name="markdownlint-fix" \ -reporter="github-pr-review" \ -filter-mode="diff_context" \ -fail-level=error < "${TMPFILE}"