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
This commit is contained in:
nodiscc 2022-08-08 22:48:52 +02:00
parent 4f8f2ecac8
commit 2eb4deb308
No known key found for this signature in database
GPG key ID: 067FC4266A4B6909
6 changed files with 40 additions and 32 deletions

View file

@ -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

View file

@ -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

9
.hecat.awesome_lint.yml Normal file
View file

@ -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

View file

@ -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

View file

@ -0,0 +1,6 @@
steps:
- name: update metadata from Github API
module: processors/github_metadata
module_options:
source_directory: ./
gh_metadata_only_missing: True

View file

@ -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