This GitHub template repository provides functionality to fetch template repositories from GitHub, display them in the UI, and create new repositories from selected templates using the GitHub API.
-
Setup GitHub Token:
- Before using this template, ensure you have a GitHub personal access token with sufficient permissions. You can generate a token here.
- Add your GitHub token as an environment variable named
GITHUB_TOKEN
in your environment or provide it directly in the HTML template.
-
File Structure:
- script.js: Contains JavaScript code for fetching template repositories, displaying them in the UI, and creating new repositories from templates.
- main.py: Includes a Flask application to serve the HTML template and handle API requests.
-
Customization:
- script.js:
- Modify the
fetchTemplateRepos
function to customize the search query for template repositories. - Adjust UI elements and styles in the
displayRepos
function to match your project's design.
- Modify the
- main.py:
- Update routes or add additional functionality as per your requirements.
- Adjust environment variable usage for the GitHub token if needed.
- script.js:
-
Integration:
- Integrate this template into your project by forking or cloning the repository.
- Customize the HTML template (
template.html
) to include additional elements or styles as required.
- Intersection Observer: Implements infinite scrolling to fetch more repositories as the user scrolls down.
- Create from Template: Allows users to create new repositories from selected templates with a custom name.
To get started, follow these steps:
- Fork or clone this repository.
- Customize the template according to your project's requirements.
- Ensure you have set up the necessary environment variables, especially the GitHub token.
- Run the Flask application using
python main.py
. - Access the application in your browser and start exploring template repositories.