Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header confirmation CI #26

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/header-confirm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Header Confirmation

on:
push:
branches:
- main
pull_request: {}

jobs:
header-confirm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install python-frontmatter
- name: Confirm headers
run: python optunahub-registry/header_confirm.py
24 changes: 24 additions & 0 deletions optunahub-registry/header_confirm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

import frontmatter


def header_confirm(path: str) -> None:
post = frontmatter.load(path)
assert "author" in post.keys(), f"author is not found in {path}"
assert "title" in post.keys(), f"title is not found in {path}"
assert "description" in post.keys(), f"description is not found in {path}"
assert "tags" in post.keys(), f"tags is not found in {path}"
assert "optuna_versions" in post.keys(), f"optuna_versions is not found in {path}"
assert "license" in post.keys(), f"license is not found in {path}"


if __name__ == "__main__":
# Check all README files under the `package` directory.
for root, dirs, files in os.walk("package"):
for file in files:
if file == "README.md":
header_confirm(os.path.join(root, file))

# Check the template file.
header_confirm("template/README.md")