Skip to content

Commit

Permalink
Merge pull request #83 from sib-swiss/auto-create-collection
Browse files Browse the repository at this point in the history
Auto create collection
  • Loading branch information
GeertvanGeest authored Mar 17, 2023
2 parents c0ac3d8 + aaf40ff commit d8c264d
Show file tree
Hide file tree
Showing 9 changed files with 621 additions and 365 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/count-courses.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/generate_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

name: generate readme
on:
schedule:
- cron: "0 0 * * SUN"
push:
branches:
- 'main'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: recreate readme
run: |
pip install requests
python scripts/create_collection_from_rest_api.py
- name: Commit and push changes
run: |
git config --global user.name "geertvangeest"
git add -A
git commit -m "auto-generated readme" || exit 0
git push
18 changes: 0 additions & 18 deletions .github/workflows/lychee-action.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/toc-generator.yml

This file was deleted.

43 changes: 0 additions & 43 deletions CONTRIBUTING.md

This file was deleted.

547 changes: 284 additions & 263 deletions README.md

Large diffs are not rendered by default.

247 changes: 247 additions & 0 deletions assets/logo-vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions scripts/collection_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[![DOI](https://zenodo.org/badge/437832906.svg)](https://zenodo.org/badge/latestdoi/437832906)

# Bioinformatics training materials

Do you like this collection? You're going to love [glittr.org](https://glittr.org)! The collection below is still maintained but updated by glittr.org. So, if you have anything to add or to ask, see you there!

[![](assets/logo-vertical.svg)](https://glittr.org)

If you haven't stopped reading, you're one of the few that still prefer the old school `README` :neckbeard:. Nice !

Below you'll find a curated list of **bioinformatics training material**. All material is:

- In a GitHub or GitLab repository
- Free to use
- Written in markdown or similar

**NOTE:** This list of courses is selected *only* based on the above criteria. There are *no* checks on quality.

## Contents

41 changes: 41 additions & 0 deletions scripts/create_collection_from_rest_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import requests

def get_repos():
r = requests.get("https://glittr.org/api/list")
collection_list = r.json()
return(collection_list)

def write_toc(collection_list, outfile):
for category in collection_list:
category_name = category['name']
outfile.write(f"- [{category_name}](#{category_name.lower().replace(' ', '-')})\n")
for topic in category['topics']:
topic_name = topic['name']
outfile.write(f" - [{topic_name}](#{topic_name.lower().replace(' ', '-')})\n")


def write_collection(collection_list, outfile):
for category in collection_list:
category_name = category['name']
outfile.write("\n## " + category_name + '\n\n')
for topic in category['topics']:
topic_name = topic['name']
outfile.write("\n### " + topic_name + '\n\n')
repo_list = topic['repositories']
for repo in repo_list:
if repo['website'] == '':
outfile.write(f"- [**{repo['author']['display_name'].strip()}** {repo['name']}]({repo['url']})\n")
else:
outfile.write(f"- [**{repo['author']['display_name'].strip()}** {repo['name']}]({repo['url']}) | [website]({repo['website']})\n")

if __name__ == '__main__':
collection_list = get_repos()

output_file = 'README.md'

with open(output_file, 'w') as outfile:
with open('scripts/collection_header.md') as infile:
for line in infile:
outfile.write(line)
write_toc(collection_list, outfile)
write_collection(collection_list, outfile)

0 comments on commit d8c264d

Please sign in to comment.