From 2eb4deb308c07d2e207de84a081102bc729c25ed Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 8 Aug 2022 22:48:52 +0200 Subject: [PATCH] tools/github actions: automate daily metadata update + commit/push changes after update - automate lint/build on changes - only run metadata updates from GH actions schedules, not from main CI workflow - ref. https://github.com/nodiscc/hecat/issues/26 - ref. https://github.com/awesome-selfhosted/awesome-selfhosted-data/issues/14 - ref. https://github.com/awesome-selfhosted/awesome-selfhosted-data/issues/4 --- .github/workflows/ci.yml | 13 ++++--------- .github/workflows/update-metadata.yml | 18 +++++++++++++----- .hecat.awesome_lint.yml | 9 +++++++++ .hecat.process.yml | 15 --------------- .hecat.update_metadata.yml | 6 ++++++ Makefile | 11 ++++++++--- 6 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 .hecat.awesome_lint.yml delete mode 100644 .hecat.process.yml create mode 100644 .hecat.update_metadata.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24793441b7..ef6a86c560 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,3 @@ -name: awesome-selfhosted CI - on: push: pull_request: @@ -10,12 +8,9 @@ env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} jobs: - build: + ci: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: process - run: make process - - name: export - run: make export + - uses: actions/checkout@v3 + - run: make awesome_lint + - run: make export diff --git a/.github/workflows/update-metadata.yml b/.github/workflows/update-metadata.yml index 6b05bd22cc..340f6e9e71 100644 --- a/.github/workflows/update-metadata.yml +++ b/.github/workflows/update-metadata.yml @@ -1,12 +1,20 @@ -name: daily metadata update - on: schedule: - - cron: '31 12 * * 1' + - cron: '55 20 * * 1' + +env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} jobs: test_schedule: runs-on: ubuntu-latest steps: - - name: update projects metadata - run: make process + - uses: actions/checkout@v3 + - run: make update_metadata + - name: commit and push changes + run: | + git config user.name awesome-selfhosted-bot + git config user.email github-actions@github.com + git add software/ tags/ platforms/ licenses*.yml + git diff-index --quiet HEAD || git commit -m "[bot] update projects metadata" + git push diff --git a/.hecat.awesome_lint.yml b/.hecat.awesome_lint.yml new file mode 100644 index 0000000000..cab8deb1ae --- /dev/null +++ b/.hecat.awesome_lint.yml @@ -0,0 +1,9 @@ +steps: + - name: data against awesome-selfhosted guidelines + module: processors/awesome_lint + module_options: + source_directory: ./ + items_in_delegate_to_fatal: False + licenses_files: + - licenses.yml + - licenses-nonfree.yml diff --git a/.hecat.process.yml b/.hecat.process.yml deleted file mode 100644 index 069136208d..0000000000 --- a/.hecat.process.yml +++ /dev/null @@ -1,15 +0,0 @@ -steps: - - name: update metadata from Github API - module: processors/github_metadata - module_options: - source_directory: ./ - gh_metadata_only_missing: True - - - name: check data against awesome-selfhosted guidelines - module: processors/awesome_lint - module_options: - source_directory: ./ - items_in_delegate_to_fatal: False - licenses_files: - - licenses.yml - - licenses-nonfree.yml diff --git a/.hecat.update_metadata.yml b/.hecat.update_metadata.yml new file mode 100644 index 0000000000..2acaf8735d --- /dev/null +++ b/.hecat.update_metadata.yml @@ -0,0 +1,6 @@ +steps: + - name: update metadata from Github API + module: processors/github_metadata + module_options: + source_directory: ./ + gh_metadata_only_missing: True diff --git a/Makefile b/Makefile index e2cd21cb30..8e5074e82c 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,15 @@ import: install source .venv/bin/activate && \ hecat --config .hecat.import.yml -.PHONY: process # apply automatic processing (gather github metadata) -process: install +.PHONY: update_metadata # update metadata from project repositories/API +update_metadata: install source .venv/bin/activate && \ - hecat --config .hecat.process.yml + hecat --config .hecat.update_metadata.yml + +.PHONY: awesome_lint # check data against awesome-selfhosted guidelines +awesome_lint: install + source .venv/bin/activate && \ + hecat --config .hecat.awesome_lint.yml .PHONY: export # export markdown singlepage document from yaml data export: install