Update check-urls.yml #12502
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check URLs from Changed Files | ||
on: | ||
push: | ||
pull_request: | ||
permissions: | ||
contents: read # Needed for checkout | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.run_id }}' | ||
cancel-in-progress: false | ||
jobs: | ||
get-changed-files: | ||
name: Get Changed Files | ||
runs-on: ubuntu-latest | ||
outputs: | ||
fetch-depth: ${{ steps.set-params.outputs.fetch-depth }} | ||
files: ${{ steps.set-files.outputs.files }} | ||
files-len: ${{ steps.set-files.outputs.files-len }} | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Determine Workflow Parameters | ||
id: set-params | ||
run: | | ||
echo "fetch_depth=0" >> $GITHUB_OUTPUT | ||
if [ "${{ github.event_name }}" == "pull_request" ]; then | ||
echo "fetch_depth=0" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ steps.set-params.outputs.fetch-depth }} | ||
- name: Identify Changed Files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45.0.5 | ||
with: | ||
separator: " " | ||
json: true | ||
- name: Set Changed Files Outputs | ||
id: set-files | ||
run: | | ||
echo "files=$(echo ${{ steps.changed-files.outputs.all_changed_files }} | jq -r '. | join(\" \")')" >> $GITHUB_OUTPUT | ||
echo "files-len=$(echo ${{ steps.changed-files.outputs.all_changed_files }} | jq -r '. | length')" >> $GITHUB_OUTPUT | ||
- name: Create Matrix for Changed Files | ||
id: set-matrix | ||
run: | | ||
echo "matrix={\"file\":${{ steps.changed-files.outputs.all_changed_files }}}" >> $GITHUB_OUTPUT | ||
check-urls: | ||
name: Check URLs @ ${{ matrix.file }} | ||
if: ${{ fromJSON(needs.get-changed-files.outputs.files-len) > 0 }} | ||
needs: [get-changed-files] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{ fromJSON(needs.get-changed-files.outputs.matrix) }} | ||
max-parallel: 10 | ||
fail-fast: false | ||
steps: | ||
- name: Checkout Code | ||
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }} | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ needs.get-changed-files.outputs.fetch-depth }} | ||
- name: Setup Ruby Environment | ||
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }} | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 | ||
- name: Install Awesome Bot | ||
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }} | ||
run: | | ||
gem install awesome_bot | ||
- name: Set Output Variables | ||
id: set-output | ||
run: | | ||
Check failure on line 77 in .github/workflows/check-urls.yml GitHub Actions / Check URLs from Changed FilesInvalid workflow file
|
||
echo "FILENAME=$(basename ${{ matrix.file }})" >> $GITHUB_OUTPUT | ||
file_path="${{ matrix.file //\//- }}" | ||
if [[ "$file_path" == "README.md" ]]; then | ||
file_path="BASE_README.md" | ||
fi | ||
echo "FILEPATH=${file_path}" >> $GITHUB_OUTPUT | ||
- name: Validate URLs in File | ||
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }} | ||
run: | | ||
awesome_bot "${{ matrix.file }}" --allow-redirect --allow-dupe --allow-ssl || true | ||
- name: Upload Validation Results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.set-output.outputs.FILEPATH }} | ||
path: ${{ github.workspace }}/ab-results-*.json | ||
reporter: | ||
name: Generate GitHub Report | ||
needs: [get-changed-files, check-urls] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Download Validation Artifacts | ||
uses: actions/download-artifact@v4 | ||
- name: Generate URL Check Summary | ||
uses: ./.github/actions/awesomebot-gh-summary-action | ||
with: | ||
ab-root: ${{ github.workspace }} | ||
files: ${{ needs.get-changed-files.outputs.files }} | ||
separator: " " | ||
append-heading: true |