浏览代码

bump actions/download-artifact from 3 to 4. Fix bug with README.md file failing to download. (#11754)

Leithen 1 年之前
父节点
当前提交
0d6a64e046
共有 1 个文件被更改,包括 17 次插入5 次删除
  1. 17 5
      .github/workflows/check-urls.yml

+ 17 - 5
.github/workflows/check-urls.yml

@@ -86,13 +86,26 @@ jobs:
           gem install awesome_bot
       - name: Set output
         id: set-output
-        run: echo "FILENAME=$(echo ${{ matrix.file }} | grep -oE '[a-zA-Z0-9_-]+(\.yml|\.md)')" >> "$GITHUB_OUTPUT"
+        # FILENAME takes the complete file path and strips everything before the final '/'
+        # FILEPATH replaces all '/' with '-' in the file path since '/' is not allowed in upload artifact name
+        # Due to a bug in actions/download-artifact, we need to rename README.md to BASE_README.md
+        run: |
+          echo "FILENAME=$(echo ${{ matrix.file }} | grep -oE '[a-zA-Z0-9_-]+(\.yml|\.md)')" >> "$GITHUB_OUTPUT"
+
+          file_path="${{ matrix.file }}"
+          file_path="${file_path//\//-}"
+
+          if [[ "$file_path" == "README.md" ]]; then
+            file_path="BASE_README.md"
+          fi
+
+          echo "FILEPATH=${file_path}" >> "$GITHUB_OUTPUT"
       - name: "Check URLs of file: ${{ matrix.file }}"
         run: |
           awesome_bot "${{ matrix.file }}" --allow-redirect --allow-dupe --allow-ssl || true;
       - uses: actions/upload-artifact@v4
         with:
-          name: ${{ steps.set-output.outputs.FILENAME}}
+          name: ${{ steps.set-output.outputs.FILEPATH }}
           path: ${{ github.workspace }}/ab-results-*.json
 
 
@@ -104,9 +117,8 @@ jobs:
       - name: Checkout  # for having the sources of the local action
         uses: actions/checkout@v4
         # download and unzip the ab-results-*.json generated by job-matrix: check-urls
-      - uses: actions/download-artifact@v3
-        with:
-          name: ${{ steps.set-output.outputs.FILENAME}}
+      - name: Download artifacts
+        uses: actions/download-artifact@v4
       - name: Generate Summary Report
         uses: ./.github/actions/awesomebot-gh-summary-action
         with: