-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from sib-swiss/auto-create-collection
Auto create collection
- Loading branch information
Showing
9 changed files
with
621 additions
and
365 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |