@@ -22,24 +22,46 @@ jobs:
2222 files : config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence.
2323 outputs :
2424 toggle_url_check_periodically : " ${{ env.URL_CHECK_PERIODICALLY }}"
25+ url_error_min : " ${{ env.URL_ERROR_MIN }}"
2526
2627 url-check :
2728 name : Check URLs
2829 needs : set-up
2930 if : ${{needs.set-up.outputs.toggle_url_check_periodically == 'true'}}
3031 runs-on : ubuntu-latest
31- container :
32- image : jhudsl/base_ottr:main
32+ outputs :
33+ status : ${{ steps.check_results.outcome }}
34+
35+ steps :
3336
37+ - name : Run the check
38+ uses : ottrproject/ottr-reports@main
39+ id : check_results
40+ continue-on-error : true
41+ with :
42+ check_spelling : false
43+ spelling_error_min : 1
44+ check_urls : true
45+ url_error_min : ${{needs.set-up.outputs.url_error_min}}
46+ check_quiz_form : false
47+ quiz_error_min : 1
48+ sort_dictionary : false
49+
50+ issue-maker :
51+ name : Create issue
52+ needs : url-check
53+ if : needs.url-check.outputs.status == 'failure' # Proceed to make an issue if the checker above failed anywhere
54+ runs-on : ubuntu-latest
3455 steps :
56+
3557 - name : Checkout
36- uses : actions/checkout@v3
58+ uses : actions/checkout@v4
3759 with :
3860 fetch-depth : 0
39-
61+
4062 # Delete the branch if this has been run before
4163 - name : Delete branch locally and remotely
42- run : git push origin --delete preview-spell -error || echo "No branch to delete"
64+ run : git push origin --delete periodic-url -error || echo "No branch to delete"
4365
4466 # Make the branch fresh
4567 - name : Make the branch fresh
@@ -49,69 +71,42 @@ jobs:
4971 git config --global user.email 'github-actions[bot]@users.noreply.github.com'
5072
5173 echo branch doesnt exist
52- git checkout -b preview-spell -error || echo branch exists
53- git push --set-upstream origin preview-spell -error || echo echo branch exists remotely
74+ git checkout -b periodic-url -error || echo branch exists
75+ git push --set-upstream origin periodic-url -error || echo echo branch exists remotely
5476 shell : bash
55-
56- - name : Run the check
57- uses : ottrproject/ottr-reports@main
58- id : check_results
59- continue-on-error : true
77+
78+ - name : Download artifact
79+ uses : actions/download-artifact@v4
6080 with :
61- check_type : urls
62- error_min : 1
63-
81+ name : ottr-check-reports
82+
6483 - name : Declare file path and time
6584 id : check-report
6685 run : |
67- error_num=$(cat check_reports/ url_checks.tsv | wc -l)
86+ error_num=$(cat url_checks.tsv | wc -l)
6887 error_num="$((error_num-1))"
6988 echo "error_num=$error_num" >> $GITHUB_OUTPUT
70- echo "error_url=https://github.com/${GITHUB_REPOSITORY}/blob/preview-spell -error/check_reports /url_checks.tsv" >> $GITHUB_OUTPUT
89+ echo "error_url=https://github.com/${GITHUB_REPOSITORY}/blob/periodic-url -error/url_checks.tsv" >> $GITHUB_OUTPUT
7190 shell : bash
7291
73- - name : Stop if failure
74- if : steps.check_results.outcome == 'failure'
75- run : exit 1
76-
7792 - name : Print out error variables
7893 run : |
7994 echo ${{ steps.check-report.outputs.error_url }}
8095 echo ${{ steps.check-report.outputs.error_num }}
8196
82- # Commit file
83- - name : Commit spell check file
84- if : ${{ steps.check-report.outputs.error_num >= 1 }}
97+ - name : Commit URL errors file
8598 env :
8699 GH_PAT : ${{ secrets.GH_PAT }}
87100 run : |
88- git add --force check_reports/ url_checks.tsv
89- git commit -m 'Add spell check file' || echo "No changes to commit"
90- git push --set-upstream origin preview-spell -error || echo echo branch exists remotely
101+ git add --force url_checks.tsv
102+ git commit -m 'Add URL check file' || echo "No changes to commit"
103+ git push --set-upstream origin periodic-url -error || echo echo branch exists remotely
91104
92- - name : Find issues
93- id : find-issue
94- env :
95- GH_PAT : ${{ secrets.GH_PAT }}
96- run : |
97- echo "$GITHUB_REPOSITORY"
98- curl -o find_issue.R https://raw.githubusercontent.com/ottrproject/ottr-reports/main/scripts/find_issue.R
99- issue_exists=$(Rscript --vanilla find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
100- echo URL issue exists: $issue_exists
101- echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT
102-
103- - name : If too many URL errors, then make an issue
104- if : ${{ steps.check-report.outputs.error_num >= 1 && steps.find-issue.outputs.issue_existence == 0}}
105+ - name : Make the issue
105106 uses : JasonEtco/create-an-issue@v2
106107 with :
107108 filename : .github/ISSUE_TEMPLATE/url-error.md
108109 env :
109110 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110111 FILE_URL : ${{ steps.check-report.outputs.error_url }}
111112 ERROR_NUM : ${{ steps.check-report.outputs.error_num }}
112-
113- - name : If no URL errors than delete the branch we made
114- if : ${{ steps.check-report.outputs.error_num < 1 }}
115- run : |
116- git config --system --add safe.directory "$GITHUB_WORKSPACE"
117- git push origin --delete preview-spell-error || echo "No branch to delete"
0 commit comments