GitHub documentation generator is an automation tool for GitHub repositories that creates and updates documentation whenever you add a file to your repository.
When you add something to your repository, UPDATE_DOC.py
will be executed by run_update_doc_script.yml
, and the new content file will be automatically visible in your DOCUMENTATION.md
file by default.
-
Place the
<b>UPDATE_DOC.py</b>
and<b>UPDATE_DOC_DATE.py</b>
files in the root of the repository. -
Create a GitHub workflow and place the source code of
run_update_doc_script.yml
within it. -
Dont forget to modify
UPDATE_DOC_DATE.py
according to your needs.
you are done ✅
-
go to Action
-
click set up a workflow yourself
-
in the place of main.yml, type run_update_doc_script.yml
-
in the box place the following yml code.
name: Update Documentation
on:
push:
branches:
- master # Update this branch name if needed
jobs:
update_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.12.1
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r REQUIREMENTS.txt
- name: Run UPDATE_DOC.py
run: python UPDATE_DOC.py
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "auto update documentation & api"
git push
- go to
settings
->Action
->General
and sroll down. In the workflow permission section, selectRead and write permissions
and click save.
Go to the Action section. If everything is ok you can something like this,
Modify the following attributes according to your need.
- title : title of the documentation. Default = "Documentation"
- sub_title : create the sub title for the documentation. Default = "Content"
- text : this is the intro text, it will be showen under the title.
- show_file : if this is true, files in the repository will be showen in the documentation. Default = True
- show_folder : if this is true, folders in the repository will be showen in the documentation. Default = True
- ignore : this is a list of folders/files which wont be added to documentation. Default = ['.github', '.git', 'UPDATE_DOC.py', 'UPDATE_DOC_DATA.py', 'LICENSE', 'virtual_env', 'pycache', 'DOCUMENTATION.md', 'README.md', 'run_doc_gen_script.yml']
- path : path of your github repository. Default = "https://github.com/mursalatul/github-doc-gen/"
- Python
- Python Automation
- GitHub Repository Automation
- GitHub Actions