diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 29466a1e3..effd6c1f6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -181,88 +181,12 @@ jobs: url-check: name: Check URLs needs: yaml-check - runs-on: ubuntu-latest if: ${{needs.yaml-check.outputs.toggle_url_check == 'yes'}} - container: - image: jhudsl/course_template:main - - steps: - - name: checkout repo - uses: actions/checkout@v3 - - - name: Configure git - run: | - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" - - branch_name='preview-${{ github.event.pull_request.number }}' - git fetch --all - git checkout $branch_name - git merge -s recursive --strategy-option=theirs origin/${{ github.head_ref }} --allow-unrelated-histories - shell: bash - - - name: URLs checker - id: url_errors - run: | - chk_results=$(Rscript scripts/url-check.R) - echo $chk_results - - echo "url_results=$chk_results" >> $GITHUB_OUTPUT - - - name: Commit URL check - run: | - branch_name='preview-${{ github.event.pull_request.number }}' - git add --force check_reports/url_checks.tsv || echo "No changes to commit" - git commit -m 'Add URL check file' || echo "No changes to commit" - git fetch - git push origin $branch_name || echo "No changes to commit" - - - name: Build components of the spell check comment - id: build-components - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - branch_name='preview-${{ github.event.pull_request.number }}' - url_errors=https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/$branch_name/check_reports/url_checks.tsv - echo "time=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - echo "commit_id=$GITHUB_SHA" >> $GITHUB_OUTPUT - echo "url_errors=$url_errors" >> $GITHUB_OUTPUT - - # Handle the commenting - - name: Find Comment - uses: peter-evans/find-comment@v2.2.0 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: broken URLs - - - name: URL errors! - if: ${{ steps.url_errors.outputs.url_results > 0 }} - uses: peter-evans/create-or-update-comment@v2.1.0 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - :warning: There are broken URLs that need to be addressed. [Read this guide for more info](https://github.com/jhudsl/OTTR_Template/wiki/How-to-set-up-and-customize-GitHub-actions-robots#check-for-broken-urls). - [Download the errors here.](${{ steps.build-components.outputs.url_errors }}) - _Comment updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_ - edit-mode: replace - - - name: Check URL results - fail if too many errors - if: ${{ steps.url_errors.outputs.url_results > 0 }} - run: exit 1 - - - name: No URL errors - if: ${{ steps.url_errors.outputs.url_results == 0 }} - uses: peter-evans/create-or-update-comment@v2.1.0 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - No broken URLs detected! :tada: - _Comment updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_ - edit-mode: replace + uses: jhudsl/ottr-reports/.github/workflows/report-maker.yml@main + with: + check_type: urls + error_min: 0 + gh_pat: secrets.GH_PAT render-preview: name: Render preview