From 3ed62e2034f98bf15781bdd2f1aace150dc19c8a Mon Sep 17 00:00:00 2001 From: Martin Morgenstern Date: Fri, 5 Apr 2024 16:04:02 +0200 Subject: [PATCH 1/4] Remove unnecessary computation of changed *.md files Signed-off-by: Martin Morgenstern --- .github/workflows/pr-markdownlint.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/pr-markdownlint.yml b/.github/workflows/pr-markdownlint.yml index 6702571d3..13f27c509 100644 --- a/.github/workflows/pr-markdownlint.yml +++ b/.github/workflows/pr-markdownlint.yml @@ -15,20 +15,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Get changed files - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: | - # Use the GitHub API to get the list of changed files - # documenation: https://docs.github.com/rest/commits/commits#compare-two-commits - DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \ - --jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename') - # filter out files that are not markdown - DIFF_DOCUMENTS=$(echo "${DIFF_DOCUMENTS}" | egrep -i "^files/.*\.md$" | xargs) - echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV - - name: Setup Node.js environment uses: actions/setup-node@v3 with: @@ -36,10 +22,8 @@ jobs: cache: npm cache-dependency-path: package-lock.json - - name: Install all npm packages run: npm ci - name: Lint markdown files - run: | - npm run lint:md $DIFF_DOCUMENTS + run: npm run lint:md From 1ed0340185353ba5cd3fcceb764a3014b53765ce Mon Sep 17 00:00:00 2001 From: Martin Morgenstern Date: Fri, 5 Apr 2024 16:06:17 +0200 Subject: [PATCH 2/4] Bump actions to fix deprecation warnings Signed-off-by: Martin Morgenstern --- .github/workflows/pr-markdownlint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-markdownlint.yml b/.github/workflows/pr-markdownlint.yml index 13f27c509..5c74a52a2 100644 --- a/.github/workflows/pr-markdownlint.yml +++ b/.github/workflows/pr-markdownlint.yml @@ -13,14 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Node.js environment - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" cache: npm - cache-dependency-path: package-lock.json + cache-dependency-path: package-lock.json - name: Install all npm packages run: npm ci From a72c851eacd930c09702978e93534e30b01dad2f Mon Sep 17 00:00:00 2001 From: Martin Morgenstern Date: Fri, 5 Apr 2024 16:12:46 +0200 Subject: [PATCH 3/4] Also trigger linting if linter version is changed Signed-off-by: Martin Morgenstern --- .github/workflows/pr-markdownlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-markdownlint.yml b/.github/workflows/pr-markdownlint.yml index 5c74a52a2..734a67030 100644 --- a/.github/workflows/pr-markdownlint.yml +++ b/.github/workflows/pr-markdownlint.yml @@ -6,6 +6,7 @@ on: - main paths: - .nvmrc + - package-lock.json - "**/*.md" jobs: From 250cac83d891f10c9cd625e101489a901726e8c8 Mon Sep 17 00:00:00 2001 From: Martin Morgenstern Date: Fri, 5 Apr 2024 16:17:49 +0200 Subject: [PATCH 4/4] Trigger workflow if the workflow itself changes Signed-off-by: Martin Morgenstern --- .github/workflows/pr-markdownlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-markdownlint.yml b/.github/workflows/pr-markdownlint.yml index 734a67030..96120ee2a 100644 --- a/.github/workflows/pr-markdownlint.yml +++ b/.github/workflows/pr-markdownlint.yml @@ -7,6 +7,7 @@ on: paths: - .nvmrc - package-lock.json + - .github/workflows/pr-markdownlint.yml - "**/*.md" jobs: