2020-09-05 16:28:15 +00:00
|
|
|
name: Check URLs from changed files
|
2022-08-31 15:53:22 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
|
2022-08-29 07:15:25 +00:00
|
|
|
permissions:
|
2023-02-24 16:35:13 +00:00
|
|
|
# needed for checkout code
|
2022-08-29 07:15:25 +00:00
|
|
|
contents: read
|
2022-08-31 15:53:22 +00:00
|
|
|
|
2022-09-21 13:25:54 +00:00
|
|
|
# This allows a subsequently queued workflow run to interrupt/wait for previous runs
|
2022-08-31 15:53:22 +00:00
|
|
|
concurrency:
|
2022-09-21 13:25:54 +00:00
|
|
|
group: '${{ github.workflow }} @ ${{ github.run_id }}'
|
|
|
|
cancel-in-progress: false # true = interrupt, false = wait
|
2022-08-31 15:53:22 +00:00
|
|
|
|
2020-08-23 17:02:31 +00:00
|
|
|
jobs:
|
2022-08-31 15:53:22 +00:00
|
|
|
|
|
|
|
# NOTE: tj-actions/changed-files.
|
|
|
|
# For push events you need to include fetch-depth: 0 | 2 depending on your use case.
|
|
|
|
# 0: retrieve all history for all branches and tags
|
2022-09-24 13:03:04 +00:00
|
|
|
# 1: retrieve only current commit (by default)
|
|
|
|
# 2: retrieve until the preceding commit
|
2023-02-24 16:35:13 +00:00
|
|
|
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 params
|
|
|
|
id: set-params
|
2022-08-31 15:53:22 +00:00
|
|
|
run: |
|
2023-02-23 15:06:07 +00:00
|
|
|
echo "fetch_depth=0" >> $GITHUB_OUTPUT
|
2022-08-31 15:53:22 +00:00
|
|
|
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
2023-02-23 15:06:07 +00:00
|
|
|
echo "fetch_depth=0" >> $GITHUB_OUTPUT
|
2022-08-31 15:53:22 +00:00
|
|
|
fi
|
2023-02-24 16:35:13 +00:00
|
|
|
- name: Checkout
|
2023-09-11 17:58:39 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-08-23 17:02:31 +00:00
|
|
|
with:
|
2023-02-24 16:35:13 +00:00
|
|
|
fetch-depth: ${{ steps.set-params.outputs.fetch-depth }}
|
2022-08-31 15:53:22 +00:00
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
2024-12-14 11:04:52 +00:00
|
|
|
uses: tj-actions/changed-files@v45.0.5
|
2022-08-31 15:53:22 +00:00
|
|
|
with:
|
|
|
|
separator: " "
|
2023-02-24 16:35:13 +00:00
|
|
|
json: true
|
|
|
|
- id: set-files
|
|
|
|
run: |
|
|
|
|
echo "${{ steps.changed-files.outputs.all_changed_files }}" \
|
|
|
|
| jq --raw-output '. | join(" ")' \
|
|
|
|
| sed -e 's/^/files=/' \
|
|
|
|
>> $GITHUB_OUTPUT
|
|
|
|
echo "${{ steps.changed-files.outputs.all_changed_files }}" \
|
|
|
|
| jq --raw-output '. | length' \
|
|
|
|
| sed -e 's/^/files-len=/' \
|
|
|
|
>> $GITHUB_OUTPUT
|
|
|
|
- id: set-matrix
|
|
|
|
run: |
|
|
|
|
echo "{\"file\":${{ steps.changed-files.outputs.all_changed_files }}}" \
|
|
|
|
| sed -e 's/^/matrix=/' \
|
|
|
|
>> $GITHUB_OUTPUT
|
|
|
|
|
2022-08-31 15:53:22 +00:00
|
|
|
|
2023-02-24 16:35:13 +00:00
|
|
|
check-urls:
|
|
|
|
name: Check @ ${{ 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
|
2024-11-19 21:22:42 +00:00
|
|
|
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }}
|
2023-09-11 17:58:39 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-24 16:35:13 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: ${{ needs.get-changed-files.outputs.fetch-depth }}
|
|
|
|
- name: Setup Ruby v2.6
|
2024-11-19 21:22:42 +00:00
|
|
|
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }}
|
2023-02-24 16:35:13 +00:00
|
|
|
uses: ruby/setup-ruby@v1
|
2020-08-23 17:02:31 +00:00
|
|
|
with:
|
2022-02-15 15:38:57 +00:00
|
|
|
ruby-version: 2.6
|
2023-02-24 16:35:13 +00:00
|
|
|
- name: Install awesome_bot
|
2024-11-19 21:22:42 +00:00
|
|
|
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }}
|
2023-02-24 16:35:13 +00:00
|
|
|
run: |
|
2022-08-31 15:53:22 +00:00
|
|
|
gem install awesome_bot
|
2024-01-15 17:06:54 +00:00
|
|
|
- name: Set output
|
|
|
|
id: set-output
|
2024-11-08 19:24:36 +00:00
|
|
|
# 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"
|
2023-02-24 16:35:13 +00:00
|
|
|
- name: "Check URLs of file: ${{ matrix.file }}"
|
2024-11-19 21:22:42 +00:00
|
|
|
if: ${{ endsWith(matrix.file, '.yml') || endsWith(matrix.file, '.md') }}
|
2022-08-31 15:53:22 +00:00
|
|
|
run: |
|
2023-02-24 16:35:13 +00:00
|
|
|
awesome_bot "${{ matrix.file }}" --allow-redirect --allow-dupe --allow-ssl || true;
|
2024-01-15 17:06:54 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2020-09-05 16:28:15 +00:00
|
|
|
with:
|
2024-11-08 19:24:36 +00:00
|
|
|
name: ${{ steps.set-output.outputs.FILEPATH }}
|
2022-08-31 15:53:22 +00:00
|
|
|
path: ${{ github.workspace }}/ab-results-*.json
|
|
|
|
|
2023-02-24 16:35:13 +00:00
|
|
|
|
|
|
|
reporter:
|
|
|
|
name: GitHub report
|
|
|
|
needs: [get-changed-files, check-urls]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout # for having the sources of the local action
|
2023-09-11 17:58:39 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-24 16:35:13 +00:00
|
|
|
# download and unzip the ab-results-*.json generated by job-matrix: check-urls
|
2024-11-08 19:24:36 +00:00
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v4
|
2023-02-24 16:35:13 +00:00
|
|
|
- name: Generate Summary Report
|
2022-08-31 15:53:22 +00:00
|
|
|
uses: ./.github/actions/awesomebot-gh-summary-action
|
|
|
|
with:
|
|
|
|
ab-root: ${{ github.workspace }}
|
2023-02-24 16:35:13 +00:00
|
|
|
files: ${{ needs.get-changed-files.outputs.files }}
|
2022-08-31 15:53:22 +00:00
|
|
|
separator: " "
|
|
|
|
append-heading: ${{ true }}
|