From 28005c507e37624aa1fdf9f54a44a1f673d3c8e5 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Tue, 24 Jan 2023 16:55:46 +0100 Subject: [PATCH 1/4] tools: github actions: add automatic URL checks using hecat/url_check module --- .github/workflows/ci.yml | 1 + .github/workflows/update-metadata.yml | 1 + .hecat/url-check.yml | 16 ++++++++++++++++ Makefile | 5 +++++ 4 files changed, 23 insertions(+) create mode 100644 .hecat/url-check.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96e14f6bbb..85f96640d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,5 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - run: make url_check - run: make awesome_lint - run: make export diff --git a/.github/workflows/update-metadata.yml b/.github/workflows/update-metadata.yml index 9b01c206e0..19289d894c 100644 --- a/.github/workflows/update-metadata.yml +++ b/.github/workflows/update-metadata.yml @@ -11,6 +11,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: make update_metadata + - run: make url_check - run: make awesome_lint - run: make export - name: commit and push changes diff --git a/.hecat/url-check.yml b/.hecat/url-check.yml new file mode 100644 index 0000000000..de4327ce66 --- /dev/null +++ b/.hecat/url-check.yml @@ -0,0 +1,16 @@ +steps: + - name: check URLs + module: processors/url_check + module_options: + source_directories: + - software + - tags + source_files: + - licenses.yml + check_keys: + - url + - source_code_url + - website_url + - demo_url + exclude_regex: + - '^https://github.com/[\w\.\-]+/[\w\.\-]+$' # don't check URLs that will be processed by the github_metadata module diff --git a/Makefile b/Makefile index 4ea8db3267..59c47147fa 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ update_metadata: install source .venv/bin/activate && \ hecat --config .hecat/update-metadata.yml +.PHONY: url_check # check URLs for dead links or other connection problems +url_check: install + source .venv/bin/activate && \ + hecat --config .hecat/url-check.yml + .PHONY: awesome_lint # check data against awesome-selfhosted guidelines awesome_lint: install source .venv/bin/activate && \ From b3f0ff50707bb78121ce5966e495ceeea848ab01 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Tue, 24 Jan 2023 17:17:25 +0100 Subject: [PATCH 2/4] tools: github actions: don't trigger duplicate workflows on pull requests --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f96640d7..f4aa063e0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ on: push: + branches: [ master ] pull_request: branches: [ master ] workflow_dispatch: From 6ad29ab5b87496c38887d6b6259ea3ece44e8cc9 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Tue, 24 Jan 2023 17:18:29 +0100 Subject: [PATCH 3/4] tools: github actions: run URL checker *after* pushing changes in the scheduled update-metadata workflow - we want the updates pushed regardless of possible URL check errors --- .github/workflows/update-metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-metadata.yml b/.github/workflows/update-metadata.yml index 19289d894c..5ced39267f 100644 --- a/.github/workflows/update-metadata.yml +++ b/.github/workflows/update-metadata.yml @@ -11,7 +11,6 @@ jobs: steps: - uses: actions/checkout@v3 - run: make update_metadata - - run: make url_check - run: make awesome_lint - run: make export - name: commit and push changes @@ -21,3 +20,4 @@ jobs: git add software/ tags/ platforms/ licenses*.yml git diff-index --quiet HEAD || git commit -m "[bot] update projects metadata" git push + - run: make url_check From 0f3b106e12e10de17c76bb6260640f2c71f61560 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Tue, 24 Jan 2023 17:51:03 +0100 Subject: [PATCH 4/4] tools: github actions: always run URL checks last in all workflows - make errors fatal/exit with code 1 if any checks are unsuccessful --- .github/workflows/ci.yml | 2 +- .hecat/url-check.yml | 1 + Makefile | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4aa063e0d..a4d35ed96e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: make url_check - run: make awesome_lint - run: make export + - run: make url_check diff --git a/.hecat/url-check.yml b/.hecat/url-check.yml index de4327ce66..4ba80e5648 100644 --- a/.hecat/url-check.yml +++ b/.hecat/url-check.yml @@ -12,5 +12,6 @@ steps: - source_code_url - website_url - demo_url + errors_are_fatal: True exclude_regex: - '^https://github.com/[\w\.\-]+/[\w\.\-]+$' # don't check URLs that will be processed by the github_metadata module diff --git a/Makefile b/Makefile index 59c47147fa..8da8fa4dca 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,6 @@ update_metadata: install source .venv/bin/activate && \ hecat --config .hecat/update-metadata.yml -.PHONY: url_check # check URLs for dead links or other connection problems -url_check: install - source .venv/bin/activate && \ - hecat --config .hecat/url-check.yml - .PHONY: awesome_lint # check data against awesome-selfhosted guidelines awesome_lint: install source .venv/bin/activate && \ @@ -39,6 +34,11 @@ export: install hecat --config .hecat/export.yml cd awesome-selfhosted && git diff --color=always +.PHONY: url_check # check URLs for dead links or other connection problems +url_check: install + source .venv/bin/activate && \ + hecat --config .hecat/url-check.yml + .PHONY: help # generate list of targets with descriptions help: @grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \2/' | expand -t20