thomasthaddeus/UpdateRepositoryList
This GitHub Action automatically updates a landing page with a list of GitHub repositories. It fetches repositories for a specified user, then updates an HTML file with repository links. Configurable via environment variables, it's ideal for keeping project documentation or personal pages dynamically updated.
Update Repository List GitHub Action
This GitHub Action automatically queries your GitHub repositories and updates an HTML file (your landing page) with a list of these repositories. It's configurable to run on a schedule or in response to specific GitHub events.
I started this project so that I could create a landing page on my GitHub.io website. Then use that to link to projects and websites throughout my account.
Features
- Automatically fetches a list of GitHub repositories for a specified user.
- Updates an HTML file with the latest list of repositories.
- Customizable to run on different triggers like push, pull request, or on a schedule.
Getting Started
These instructions will guide you through setting up and running the action on your own repository.
Prerequisites
- A GitHub account.
- A GitHub repository where you want to use this action.
- (Optional) A Personal Access Token (PAT) if you need to access private repositories.
Local Setup
-
Clone the repository:
git clone https://github.com/thomasthaddeus/UpdateRepositoryList.git
-
Set up the environment variables:
Create a
.envfile in your project root and add the following:MY_GITHUB_USERNAME=your-github-username MY_GITHUB_TOKEN=your-github-token
Local Development
To run and test the script locally, follow these steps:
-
Install dependencies:
npm install
-
Run the script:
npm run start
Setup
-
Clone the Repository
Clone this repository into your GitHub account.
-
Configure Environment Variables
- Create a
.envfile at the root of your project. - Add your GitHub username and (optionally) a personal access token to the
.envfile:
MY_GITHUB_USERNAME=your-username MY_GITHUB_TOKEN=your-personal-access-token
- Create a
-
GitHub Secrets
For production use, set your GitHub username and personal access token as secrets in your repository settings:
MY_GITHUB_USERNAMEMY_GITHUB_TOKEN(your PAT)
GitHub Actions Workflow
-
Set Secrets:
Add
MY_GITHUB_USERNAMEandMY_GITHUB_TOKENas secrets in your GitHub repository settings. -
Workflow Configuration:
Edit
.github/workflows/main.ymlto configure the triggers for running the action. -
Customize Landing Page Template
Modify the HTML templates in the
templatesdirectory as needed to fit the design of your landing page.
HTML File Configuration
- Set the path to your HTML file in the workflow file using the
HTML_FILE_PATHenvironment variable.
Usage
Once set up, the action will run according to the triggers defined in your workflow file. You can customize the triggers in the .github/workflows/main.yml file.
Running Tests
To ensure the reliability of the code, you can run the included tests:
npm testThis will execute the test cases defined in the __tests__ directory using Jest.
Contributing
We welcome contributions to this project! Whether it's bug fixes, feature additions, or improvements in documentation, your help is appreciated. Here's how you can contribute:
- Fork the Repository: Create a fork of this repository.
- Create a Feature Branch:
git checkout -b feature/YourAmazingFeature. - Commit Your Changes:
git commit -m 'Add some amazing feature'. - Push to the Branch:
git push origin feature/YourAmazingFeature. - Open a Pull Request: Go to your forked repo on GitHub and open a pull request.
Reporting Issues
If you encounter any issues or have suggestions for improvements, please report them using the repository's issue tracker.
License
This project is licensed under the MIT License - see the LICENSE file for details.